I don’t have time to look into this, and probably won’t for a little while, but my initial guess is that the OpenCVC library might be built for Intel only on mac, not universal, which could explain the slowdown. It’s been several months since the last set of updates, and I just don’t recall the build settings on that.
I’m just swamped with other work. My target is Windows, so that’s where I have the most experience, but most of the development has been done on Mac.
That being said, you’re using imDecode here, which may account for some of the slowdown you’re seeing since it’s converting the image to a JPEG.
In my film scanner app, I work with the raw bitmap data off of a frame grabber. That data has no formatting so there’s no conversion to JPEG. If you start your timer after the imDecode line, I’d be curious to see if it’s significantly faster. If I recall, the benchmarks I did back when I first did the documentation were testing only the CVCResize
function against the other scaling operations, and not anything leading into or coming out of it. A fair test of the speed to resize would be to only measure the time around the actual function doing the resizing, not including any format conversions
This is the entirety of the code I use to display a raw 14k x 10k frame grab in a much smaller canvas preview window, and it’s very fast:
(frame
is a pre-existing CVCMat passed to this method, containing the raw frame grab, so this code is purely about resizing it)
//determine the size of the canvas
Var scaledSize As New openCV.CVCSize(wMainWindow.PreviewCanvas.Width, wMainWindow.PreviewCanvas.Height)
//resize the image in openCV to fit the canvas
var resizedImage as New openCV.CVCMat
openCV.imgProc.CVCresize(frame, resizedImage, scaledSize, 0.0, 0.0, openCV.InterpolationFlags.Area)
//convert the image to a png for display
var displayFrame as picture = resizedImage.imageToPNG
//draw to the preview Canvas
wMainWindow.PreviewCanvas.Backdrop = displayFrame
It may very well be possible that working on a JPEG is a bit slower than working with the raw image data, but I’ve never tested that because I only work with the raw bitmap until the end, when it’s saved to a file, or as in the function above where it’s converted to a smaller PNG for display.