Comments (5)
public class GPUPixelSourceRawInput extends GPUPixelSource { public GPUPixelSourceRawInput() { if (mNativeClassID != 0) return; GPUPixel.getInstance().runOnDraw(new Runnable() { @Override public void run() { mNativeClassID = GPUPixel.nativeSourceRawInputNew(); } }); } public void SetRotation(int rotation) { GPUPixel.nativeSourceRawInputSetRotation(mNativeClassID, rotation); } public void uploadBytes(final int[] pixels, int width, int height, int stride) { GPUPixel.nativeSourceRawInputUploadBytes(mNativeClassID, pixels, width, height, stride); proceed(true, false); } }
I think it should be
public class GPUPixelSourceRawInput extends GPUPixelSource { public GPUPixelSourceRawInput() { if (mNativeClassID != 0) return; mNativeClassID = GPUPixel.nativeSourceRawInputNew(); } public void SetRotation(int rotation) { GPUPixel.nativeSourceRawInputSetRotation(mNativeClassID, rotation); } public void uploadBytes(final int[] pixels, int width, int height, int stride) { GPUPixel.nativeSourceRawInputUploadBytes(mNativeClassID, pixels, width, height, stride); proceed(true, false); } }
extern "C" jlong Java_com_pixpark_gpupixel_GPUPixel_nativeSourceRawInputNew( JNIEnv* env, jclass) { return 0; };
--->
extern "C" jlong Java_com_pixpark_gpupixel_GPUPixel_nativeSourceRawInputNew( JNIEnv* env, jclass) { return SourceRawDataInput(); };
I tried to make edits on it, but the uploadBytes function isn't working.
It sounds like GPUPixelContext::getInstance()->runSync is supposed to create an eglContext if needed, but when I call this method, I encounter a rendering thread error.
If you encounter a rendering thread error with that function, you may try manually setup GL. I managed to run it on windows.
void InitIO()
{
window = GPUPixelContext::getInstance()->GetGLContext();
if (window == NULL) {
std::cout << "Failed to create GLFW window" << std::endl;
glfwTerminate();
return;
}
glfwMakeContextCurrent(window);
if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) {
std::cout << "Failed to initialize GLAD" << std::endl;
return;
}
GPUPixelContext::getInstance()->runSync([&] {
face_reshape_filter_ = FaceReshapeFilter::create();
beauty_face_filter_ = BeautyFaceFilter::create();
source_raw_input = SourceRawDataInput::create();
target_raw_data_output = TargetRawDataOutput::create();
source_raw_input->RegLandmarkCallback([=](std::vector<float> landmarks) {
face_reshape_filter_->SetFaceLandmarks(landmarks);
});
source_raw_input->addTarget(face_reshape_filter_)
->addTarget(target_raw_data_output);
});
target_raw_data_output->setPixelsCallbck(
[=](const uint8_t* data, int width, int height, int64_t timestamp) {
cv::Mat output(height, width, CV_8UC4, (void*)data);
showmat = output;
std::cout << "target output callback" << endl;
});
}
from gpupixel.
Raw data can be obtained through readPixelsWithPBO and rawOutputCallback
Seems that the TargetRawOutput class has not been implemented yet, could you provide some reference or examples?
from gpupixel.
Raw data can be obtained through readPixelsWithPBO and rawOutputCallback
Seems that the TargetRawOutput class has not been implemented yet, could you provide some reference or examples?
sourceRawDataInput->uploadBytes(width, height, dataY, strideY, dataU, strideUV, dataV, strideUV, timestamp); isExpect=true; targetRawDataOutput->readPixelsWithPBO(width,height); …… …… …… void rawOutputCallback(const uint8_t* data, int width, int height, int64_t ts) { if(!isExpect){ return; } //obtain yuv data }
Yeah I know how to use it in c++, but not good at writing jni and android codes. The example provided by GPUPixel has not implemented targetrawdataoutput class in jni and java, that's the problem. Anyway, thanks for the answer.
from gpupixel.
public class GPUPixelSourceRawInput extends GPUPixelSource {
public GPUPixelSourceRawInput() {
if (mNativeClassID != 0) return;
GPUPixel.getInstance().runOnDraw(new Runnable() {
@Override
public void run() {
mNativeClassID = GPUPixel.nativeSourceRawInputNew();
}
});
}
public void SetRotation(int rotation)
{
GPUPixel.nativeSourceRawInputSetRotation(mNativeClassID, rotation);
}
public void uploadBytes(final int[] pixels, int width, int height, int stride) {
GPUPixel.nativeSourceRawInputUploadBytes(mNativeClassID, pixels, width, height, stride);
proceed(true, false);
}
}
I think it should be
public class GPUPixelSourceRawInput extends GPUPixelSource {
public GPUPixelSourceRawInput() {
if (mNativeClassID != 0) return;
mNativeClassID = GPUPixel.nativeSourceRawInputNew();
}
public void SetRotation(int rotation)
{
GPUPixel.nativeSourceRawInputSetRotation(mNativeClassID, rotation);
}
public void uploadBytes(final int[] pixels, int width, int height, int stride) {
GPUPixel.nativeSourceRawInputUploadBytes(mNativeClassID, pixels, width, height, stride);
proceed(true, false);
}
}
extern "C" jlong Java_com_pixpark_gpupixel_GPUPixel_nativeSourceRawInputNew(
JNIEnv* env,
jclass) {
return 0;
};
--->
extern "C" jlong Java_com_pixpark_gpupixel_GPUPixel_nativeSourceRawInputNew(
JNIEnv* env,
jclass) {
return SourceRawDataInput();
};
I tried to make edits on it, but the uploadBytes function isn't working.
It sounds like GPUPixelContext::getInstance()->runSync is supposed to create an eglContext if needed, but when I call this method, I encounter a rendering thread error.
from gpupixel.
Related Issues (20)
- 测试了一张多个人脸的图片,从左到右只有第一个人脸生效,不支持多个人脸吗?[Contribution Request] HOT 2
- [Help] Integrate GPUPixel into WebRTC applications HOT 5
- Openface和VNN比怎么样呢?用OpenFace替换掉行吗? HOT 1
- Can You share sample android studio project?[Feature Request] HOT 1
- [BUG] Error encountered during compilation for MacOS HOT 2
- [Feature Request]是否支持在arm架构下的linux系统进行编译和运行 HOT 2
- iOS相机的清晰度不高 HOT 2
- [Feature Request] iOS中,gpupixel 是否可以和GPUImage 同时使用
- [BUG]滤镜效果的问题
- 编译始终报错fatal error LNK1104: 无法打开文件“glfw3.lib” HOT 8
- 安卓SDK集成问题 HOT 2
- [Feature Request]请问如何添加新的素材 HOT 1
- [BUG] 感觉有内存泄露的问题
- null
- [BUG] HOT 1
- 这个要怎么输出成mov或者mp4等格式的视频 HOT 1
- [BUG] VNN model face landmark index information and coordinate transformation
- [BUG] Android: TargetRawDataOutput work wrong HOT 2
- [BUG]Windows上运行时,软件窗体最大化时,输出的数据会有脏数据(脏数据是整个软件窗口的画面,相机画面没有充满整个窗体,只处理相机画面) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gpupixel.