Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
1

[SDK] Glithes when playback video

Explorer ,
Jun 08, 2023 Jun 08, 2023

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. 

yuriy80149087_0-1686234020517.png

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:

yuriy80149087_1-1686234643505.png

 

TOPICS
Error or problem , SDK
503
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Jun 08, 2023 Jun 08, 2023

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:

yuriy80149087_0-1686253202619.png

 

Translate
Community Expert ,
Jun 08, 2023 Jun 08, 2023

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 08, 2023 Jun 08, 2023

Yes, this is the code that shows that I copy the input layer into cv::mat. Here is the code I use to output

yuriy80149087_0-1686244960519.png

and fn :

yuriy80149087_1-1686245013743.png

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 08, 2023 Jun 08, 2023

It's message on this types of frames. I get an exception that I can't handle.

yuriy80149087_0-1686245679014.png

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 08, 2023 Jun 08, 2023

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?

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 08, 2023 Jun 08, 2023

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:

yuriy80149087_0-1686253202619.png

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 08, 2023 Jun 08, 2023

is the problem soved?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 08, 2023 Jun 08, 2023
LATEST

yep, issue was with iterate()

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines