Advice:
Create two local Integers (say vWidth As Integer and vHeight As Integer), fill them with the vlues, check the values and pass vWidth and vHeight to New Picture.
You may check in the Debugger the vWidth and vHeight values to be sure everything is OK.
Which version of Xojo? macOS, Windows, Linux? Can you make an example? Do you get a crash log that you could post? Have you verified that v is not nil and has sensible values for width and height?
I forgot! often the function is performed normally. Only a few times I have an error. I believe it may be internal to directshow, but the frustrating thing is that not even a try…catch … avoids the sudden crash. No error message. the program closes and you return to the xojo idea. I therefore cannot even identify the nature of the error
let’s say that the call, basically, works. If I then change the camera, I have a system that resizes the preview of the live stream (which contains this function). At that point, not at the first change, sometimes it crashes
I have already done the test with the intermediate values, using support variables. Reading v.width and v.height never gave an error. The error was always on the “New Picture (…)”
maybe the operating system dedicates a slice of memory to the running app and, when this threshold is reached, fatal errors occur? I’m not sure how these aspects work.
done. and I think I have had confirmation of what I had already suspected. With a certain resolution, the memory occupied by the app even goes up to 2 GB. With a higher resolution, it goes beyond 3.5!
at this point I believe that instruction will crash ONLY when the memory is full. that’s why, in other situations, it works regularly.
it’s not that simple to explain. It is a very complex acquisition system, with different types of acquisition. In short, behind it there is a system that collects a few frames and, by calling the pause, you can go back / forward one frame at a time. The solution is to reduce the maximum number of retained frames (from 500 to 100, for example)
I worked with a photofinish system (as a user, not a developer). It keeps some images in memory, but beyond a certain number of images, older ones are transferred to disk. Once the picture acquisition is completed, the remaining images are saved from memory to disk. The navigation back and forth uses in-memory images loaded from a determined time point. Perhaps you could implement something similar? The key here is that every image is a very thin vertical slice of space, taking relatively little memory each.