-1

I am looking for a library that could capture streams of images from webcam or USB camera, and then converting image data into multidimensional matrices, in order to do some mathematical operation on them; afterward saving the result as a png file.

I am stuck in the first step. It seems there is only opencv to capture images from camera, which uses highgui.dll for the job. Unfortunately after installing opencv using nimble install opencv, and running a simple code

import opencv/imgproc
import opencv/highgui
import opencv/core
var capture = captureFromCam(CAP_ANY)

the error could not load: (lib|)opencv_highgui(249|231|)(d|).dll arises. Opencv cannot find the library to import necessary functions from it. So far I could not find any way to overcome this issue. In standard libraries of Nim, there are two libraries serial and winim that if I am not wrong, are handling device ports. I could not find a simple way to use them. The question is, what is the proper library for handling devices and how to use them in a simple manner?

For the rest of the job (manipulating image data) I think pixie is a good library to use. It would be good to know, if there is better library, in simplicity and performance.

Shoaib Mirzaei
  • 512
  • 4
  • 11
  • 2
    `(249|231|)`? whatever you installed is YEARS out of date. sorry, talk to the maintainer of the nim package. – Christoph Rackwitz Jan 15 '23 at 21:12
  • Installation process was proceed with `nimble install opencv`. the package is old, but when I copy necessary files from the same version beside the code, it could not load the functions. I asked this question because I wanted it to get developers' attention about the way for handling devices in nim. – Shoaib Mirzaei Feb 13 '23 at 17:57

1 Answers1

2

As Christoph said, the nim package seems years out of date. However if you download Version 249 and put the right dlls into your directory or link them through your nimble file, your code will run.

For your code you would need to copy from opencv\build\x64\vc12\bin files opencv_core249.dll, opencv_highgui249.dll and opencv_imgproc249.dll

You might want to instead just write a quick wrapper for the functions you need from a newer version yourself since you probably only need a few functions. You can look at the nim-opencv library for how to wrap functions.

Or you could use a different application to capture the footage and nim to process it.

add-IV
  • 66
  • 5
  • This is a possible way to do that. the problem is, the thinking way of developers is somehow different with others that tries to understand their work, make it hard to read. if you ask them they of course say and believe that this is the best way of coding but it's not. – Shoaib Mirzaei Feb 13 '23 at 18:06