Copy link to clipboard
Copied
Hi. I'm trying to create a plugin, but there is a small problem that manifests itself as follows. Sometimes glitches of this kind appear. It happens every few seconds or right away, and is generally indefinite in nature.
I noticed that they appear very often, if you yourself quickly clear the memory buffer Ctrl + Alt + /. If I pass image from params[0] directly to iterate function and assign there, there's no such thing, but if I add my own function to render function which just copies pixels from params[0] to opencv matrix (cv::Mat) using next loop, then such problems appear. These glitches appear regardless of the multithreading flag or the openmp directives.
Code:
anyways, is this error random? some frames are ok and some go bad? - Yes, for the most part they work out fine, only a few shots out of hundreds are like that.
Nevertheless, I found a mistake. It's about iterate in suites, by replacing them all with nested for I got stable playback. I don't know what is the reason for such behavior suites->iterate(). In any case their speed is comparable to openmp.
Worked Code for output:
Copy link to clipboard
Copied
perhaps you posted some very partial code, but where's the assignment back to the output buffer in that loop? only see the copying into the CV matrix.
if the image is sometimes ok and sometimes not, them perhaps your calculations are relying on the output buffer being clean to begin with, which is not guaranteed. that doesn't affect simple copying as it overwrites existing data and does not composite over it.
just two ideas off the top of my head.
Copy link to clipboard
Copied
Yes, this is the code that shows that I copy the input layer into cv::mat. Here is the code I use to output
and fn :
It may seem strange why I use a simple loop first, but I use the iterate function to copy into the output. But I used loop only because I thought, that these glitches appear because of multithreaded processing of iterate, because it just doesn't have time to copy everything to cv::mat and later uses broken data. But that wasn't the point.
Copy link to clipboard
Copied
It's message on this types of frames. I get an exception that I can't handle.
Copy link to clipboard
Copied
i do not speak open cv... but when doing image->at<float>(xL, yL), i don't see how you take the differend components each time. seems to me like you're casting a pixel into a float and not a channel...
anyways, is this error random? some frames are ok and some go bad?
Copy link to clipboard
Copied
anyways, is this error random? some frames are ok and some go bad? - Yes, for the most part they work out fine, only a few shots out of hundreds are like that.
Nevertheless, I found a mistake. It's about iterate in suites, by replacing them all with nested for I got stable playback. I don't know what is the reason for such behavior suites->iterate(). In any case their speed is comparable to openmp.
Worked Code for output:
Copy link to clipboard
Copied
is the problem soved?
Copy link to clipboard
Copied
yep, issue was with iterate()