Note onto scicv function VideoWriter_write()

Dear all,

using the scicv toolbox for avi creation I stumbled over a rather confusing bug.
The bug is most likely not directly based on Scilab , but rather depends on openCV.
However, since it took me a while to figure this out, I rather share some info:

Setup:

  • step 1: use xs2png() to export a number of graphics to a number of images
  • step 2: use VideoWriter_write() to add all images into a single avi

Within step 1 the figure size is initiated for the 1st graph with:

    f.figure_size = [FIG_WIDTH FIG_HEIGHT];

Later graphs just update the figure content, but the figure itself is not re-created.

So theoretically all images saved with xs2png have the same pixel-size.

In praxis it turned out, that the figure size did change due to remotly accessing the operating PC, which brings me to the issue with VideoWriter_write:

VideoWriter_write will not raise an error / notification etc. if the image that is going to be added
does not fit the specified avi pixel resolution.

In fact the avi is created, but maybe contains only some frames..which happend to have the correct 
pixel size.

It took me quite some time to figure this out, checking and rechecking my scilab code, which at first perfectly worked well but out of the sudden did not anymore.

So as mentioned…this seems to be an issue in openCV…see here:

The issue might be known in the openCV community, but as a scilab user I do not read openCV forums to start code debugging. The issue seems also to be still unsolved in openCV…see here.

  https://github.com/opencv/opencv/issues/19670

As a work around I now have a function to check all images onto the pixel size before adding them up into an avi.

As regards to Scilab, I wonder if a short statement in the VideoWriter_write () help page could be implemented to give users a guideline / hint about the subject.

Best Regards,
Philipp

Hello Philipp,

Thanks for this report and the detailed explanation. Can you open an issue on the scicv toolbox page (scilab / forge / scicv · GitLab) ? BTW, do you confirm that the toolbox works out-of-the box for Scilab 2023.0. ?

S.

Hello Stéphane,

as for the GitLab repository:

   How to create an issue? Do I need to register?

As for scicv and Scilab 2023.0. :

   At least on my Win10 machine scicv could not be installed using atoms.

  The scicv version found by atoms is 0.6.2.

  Atoms message popup:  Installlation failed

  console error message:  Error while building the toolbox "path-to-toolbox-folder"

 I tried this while opening Scilab as normal user and "as admin".

Best regards,
Philipp

Hello,

There is a general problem with the toolboxes loading mechanism in 2023.0.0: all toolboxes are supposed to build out-of-the box, hence when binaries do not exists for a given platform, the toolbox source is loaded on-the-fly and the builder is run. In many cases (e.g. when the toolbox build does not need a compiler), this works fine and reveals ancient toolboxes that are available again (without having to be rebuilt on atoms portal). But in other cases it fails, which is the case of scicv. I will see what I can do for scicv, but I am not the author of this particular one…

S.

Hi Philipp,

Can you update the package list in your Atoms GUI and try to install again ? I rebuilt the Windows package.

S.

Hello Stéphane,

yes, that is working.

  • update list of packages in atoms … done
  • install scicv in atoms … successful
  • Restart Scilab … scicv is recognized as installed package
  • testing some scicv examples … Ok

I guess scicv can now be added to the growing list of “Atoms packages available for Scilab 2023.0.0”

see: Atoms packages available for Scilab 2023.0.0

Thanks a lot.
Philipp

Already done ! However, the exposed features are not as complete as those of IPCV.

S.