Getpixels have some problem in emscripten

This is my code to display video
fingerMovie is meaning ofVideoPlayer fingerMovie;
and img is ofxCvColorImage img;

fingerMovie.draw(20,20,320,240);
ofPixels  pixels = fingerMovie.getPixels();
cout<<"h1"<<pixels.getHeight();
cout<<"w1"<<pixels.getWidth()<<std::endl;
pixels.resize(320,240);
cout<<"h2"<<pixels.getHeight();
cout<<"w2"<<pixels.getWidth()<<std::endl;
img.setFromPixels(pixels);
cv::Mat mat=ofxCv::toCv(img);
convertImg(mat,mat);

img.draw(400,20);

this code is working in linux.
but if I ran this code in web(emscripten ) ,it caused error.
fingerMovie.getPixels(); return (width.height)=(0,0);
Please tell me why.
output screen show this
h1 0w1 0
h2 0w2 0
[ error ] ofxCvColorImage: setFromPixels(): width and height are zero
[warning] ofxCvImage: getPixels(): image not allocated
[ error ] ofPixels: format doesn’t support channels

Please tell me why ?
How to solve this.

not inpriment now?

OK I solved this promblem.
at start ,some frame return NULL frame and some sec after show right frame
so solution is add if(w>0 &&h>0)

but caused next problem
don’ return from setFromPixels()
why ?
output is this
[notice ] ofxCvColorImage: setFromPixels(): allocating to match dimensions: 0 0
IPDL protocol error: Handler returned error code!

Sorry Stopping function is ```
convertImg(mat,mat);
and
img.setFromPixels(pixels);
IS OK.
convertImg is this
void ofApp::convertImg(cv::Mat mat,cv::Mat matout){

double dSigmaSpatial=90;
double dSigmaColor=90;
dcf=cv::ximgproc::createDTFilter(mat,dSigmaSpatial,dSigmaColor);
dcf->filter(mat,mat);
dcf->filter(mat,mat);
matout=mat;

}
Why cannot get return?

I found freeze come from
dcf=cv::ximgproc::createDTFilter(mat,dSigmaSpatial,dSigmaColor);
so I analyzed this function in opencv source code.
Its core function is this:
template
void DTFilterCPU::init_(Mat& guide, double sigmaSpatial_, double sigmaColor_, int mode_, int numIters_)
{
CV_Assert(guide.type() == cv::DataType::type);

this->release();

h = guide.rows;
w = guide.cols;

sigmaSpatial = std::max(1.0f, (float)sigmaSpatial_);
sigmaColor   = std::max(0.01f, (float)sigmaColor_);

mode = mode_;
numIters = std::max(1, numIters_);

if (mode == DTF_NC)
{
    {
        ComputeIDTHor_ParBody<GuideVec> horBody(*this, guide, idistHor);
        parallel_for_(horBody.getRange(), horBody);
    }
    {
        Mat guideT = guide.t();
        ComputeIDTHor_ParBody<GuideVec> horBody(*this, guideT, idistVert);
        parallel_for_(horBody.getRange(), horBody);
    }
}
else if (mode == DTF_IC)
{
    {
        ComputeDTandIDTHor_ParBody<GuideVec> horBody(*this, guide, distHor, idistHor);
        parallel_for_(horBody.getRange(), horBody);
    }
    {
        Mat guideT = guide.t();
        ComputeDTandIDTHor_ParBody<GuideVec> horBody(*this, guideT, distVert, idistVert);
        parallel_for_(horBody.getRange(), horBody);
    }
}
else if (mode == DTF_RF)
{
    ComputeA0DTHor_ParBody<GuideVec> horBody(*this, guide);
    ComputeA0DTVert_ParBody<GuideVec> vertBody(*this, guide);
    parallel_for_(horBody.getRange(), horBody);
    parallel_for_(vertBody.getRange(), vertBody);
}
else
{
    CV_Error(Error::StsBadFlag, "Incorrect DT filter mode");
}

}

parallel???
This function is using thread …:confounded:
so my function is freezed.:-1:

Does anyone have good idea to escape this?
Please tell me how to use thread in emscripten(ver 1.38.9)
I heard "-s USE_PTHREAD=1 " is experimental and must change browser setting.
Please send me some good idea.

emscripten doesn’t support threads cause browsers don’t have support for threads as understood when programming for the desktop so anything that uses threads will probably not work.

Not sure if there’s a way to compile opencv to disable parallelism? probably disabling things like tbb and openmp

I checked openMP and TBB is already off .but WITH_PTHREADS_PF is ON
I found it now😱
so I will change it off and try
pray for me

Ok
Solved
to use opencv in emscripten I must put off WITH_PTHREADS_PF
It’s too hard for a beginner like me

yes, this sounds like a bug on our side, i’ve opened an issue to fix it for next release https://github.com/openframeworks/apothecary/issues/120