# Note onto scicv function VideoWriter\_write()

**URL:** <https://scilab.discourse.group/t/note-onto-scicv-function-videowriter-write/79>\
**Category:** Signal and image processing\
**Created:** [April 12, 2023, 3:11pm UTC](https://scilab.discourse.group/t/note-onto-scicv-function-videowriter-write/79 "2023-04-12T15:11:37Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![philipp](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/philipp/32/53_2.png) [@philipp](https://scilab.discourse.group/u/philipp)\
**Post date:** [April 12, 2023, 3:11pm UTC](https://scilab.discourse.group/t/note-onto-scicv-function-videowriter-write/79/1 "2023-04-12T15:11:37Z")

</div>

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:

> <https://stackoverflow.com/questions/43279348/python-opencv-videowriter-opencv-frame-size-does-not-match-video-size>

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

---

<div class="post-metadata">

**Author:** ![mottelet](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/mottelet/32/13_2.png) [@mottelet](https://scilab.discourse.group/u/mottelet)\
**Post date:** [April 13, 2023, 6:37am UTC](https://scilab.discourse.group/t/note-onto-scicv-function-videowriter-write/79/2 "2023-04-13T06:37:25Z")

</div>

Hello Philipp,

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

S.

---

<div class="post-metadata">

**Author:** ![philipp](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/philipp/32/53_2.png) [@philipp](https://scilab.discourse.group/u/philipp)\
**Post date:** [April 14, 2023, 6:13am UTC](https://scilab.discourse.group/t/note-onto-scicv-function-videowriter-write/79/3 "2023-04-14T06:13:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mottelet](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/mottelet/32/13_2.png) [@mottelet](https://scilab.discourse.group/u/mottelet)\
**Post date:** [April 14, 2023, 6:46am UTC](https://scilab.discourse.group/t/note-onto-scicv-function-videowriter-write/79/4 "2023-04-14T06:46:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mottelet](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/mottelet/32/13_2.png) [@mottelet](https://scilab.discourse.group/u/mottelet)\
**Post date:** [April 14, 2023, 9:28am UTC](https://scilab.discourse.group/t/note-onto-scicv-function-videowriter-write/79/5 "2023-04-14T09:28:45Z")

</div>

Hi Philipp,

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

S.

---

<div class="post-metadata">

**Author:** ![philipp](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/philipp/32/53_2.png) [@philipp](https://scilab.discourse.group/u/philipp)\
**Post date:** [April 14, 2023, 12:14pm UTC](https://scilab.discourse.group/t/note-onto-scicv-function-videowriter-write/79/6 "2023-04-14T12:14:45Z")

</div>

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](https://scilab.discourse.group/t/atoms-packages-available-for-scilab-2023-0-0/65/1)

Thanks a lot.  
Philipp

---

<div class="post-metadata">

**Author:** ![mottelet](https://yyz2.discourse-cdn.com/free1/user_avatar/scilab.discourse.group/mottelet/32/13_2.png) [@mottelet](https://scilab.discourse.group/u/mottelet)\
**Post date:** [April 14, 2023, 12:27pm UTC](https://scilab.discourse.group/t/note-onto-scicv-function-videowriter-write/79/7 "2023-04-14T12:27:59Z")

</div>

> [@philipp](#):
>
> I guess scicv can now be added to the growing list of “Atoms packages available for Scilab 2023.0.0”

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

S.
