Recent

Author Topic: Opencv version 4.6 C++ API wrapper  (Read 8159 times)

gidesa

  • Full Member
  • ***
  • Posts: 172
Re: Opencv version 4.6 C++ API wrapper
« Reply #30 on: November 14, 2024, 04:11:49 pm »
Hello,
for Opencv wrapper released many improvements and new examples:
- classes that encapsulate OCV vectors and pointers.
- a component to write movies from a video stream.
- an example for movie writing,
- an example that uses Machine Learning classifiers to recognize handwritten digits.
- a detailed documentation
See at 
https://github.com/gidesa/ocvWrapper46



Mongkey

  • Sr. Member
  • ****
  • Posts: 446
Re: Opencv version 4.6 C++ API wrapper
« Reply #31 on: June 21, 2025, 01:20:34 pm »
hello gidesa, i found error compiling on dnn2 sample, this following line was throwing error:

Code: Pascal  [Select][+][-]
  1. netResult:=TOcvParamMat.Create(resdims, cvSingle, 1, dptr);

frmDnnObjectDetection2.pas(227,58) Error: Incompatible type for arg no. 3: Got "ShortInt", expected "TOcvDataType"

how to solve this error?
Thank you.

Lazarus 3.6 (rev lazarus_3_6) FPC 3.2.2 x86_64-win64-win32/win64
« Last Edit: June 21, 2025, 01:22:15 pm by Mongkey »

gidesa

  • Full Member
  • ***
  • Posts: 172
Re: Opencv version 4.6 C++ API wrapper
« Reply #32 on: June 21, 2025, 06:55:53 pm »
hello gidesa, i found error compiling on dnn2 sample, this following line was throwing error:

Code: Pascal  [Select][+][-]
  1. netResult:=TOcvParamMat.Create(resdims, cvSingle, 1, dptr);

frmDnnObjectDetection2.pas(227,58) Error: Incompatible type for arg no. 3: Got "ShortInt", expected "TOcvDataType"

how to solve this error?
Thank you.

Lazarus 3.6 (rev lazarus_3_6) FPC 3.2.2 x86_64-win64-win32/win64

Hello, add this in Var section:
Code: Pascal  [Select][+][-]
  1.   defaultArr: TArray<UInt64>;

Then, in procedure add defaultArr as last parameter of constructor:
Code: Pascal  [Select][+][-]
  1.    
  2.     SetLength(defaultArr, 0);
  3. {..............................................}
  4.     for j:=0 to  nrDetections-1 do
  5.     begin
  6.        // define a 1 x outW mat  over a block of the output matrix
  7.        netResult:=TOcvParamMat.Create(resdims, cvSingle, 1, dptr, defaultArr);
  8.       {..............................................}

Now fixed in repository.

« Last Edit: June 21, 2025, 07:06:50 pm by gidesa »

Mongkey

  • Sr. Member
  • ****
  • Posts: 446
Re: Opencv version 4.6 C++ API wrapper
« Reply #33 on: June 22, 2025, 07:07:01 am »
Thank you gidesa,
Working very well, seems very promising fast detection, from 1 to 10 score, our lovely pascal wrapper got how many score compared to python and c++ from your point of view?

gidesa

  • Full Member
  • ***
  • Posts: 172
Re: Opencv version 4.6 C++ API wrapper
« Reply #34 on: June 22, 2025, 06:00:09 pm »
Thank you gidesa,
Working very well, seems very promising fast detection, from 1 to 10 score, our lovely pascal wrapper got how many score compared to python and c++ from your point of view?

Thank you. Indeed note that the wrapper is just .... a wrapper on calculations done inside Opencv library, written in C++. So C++ remains faster, because interfacing from main program is more straighforward. And because heavy optimization work was done on some of its compilers (but not all C++ compilers are better than Pascal ones).
And, for heavy processing with millions of detection cycles  (realtime detection from a camera, or processing thousands of images), Pascal remains much better than Python.
I have done a little robot that just use this wrapper for continuous autonomous obstacle detection and object recognition.

Mongkey

  • Sr. Member
  • ****
  • Posts: 446
Re: Opencv version 4.6 C++ API wrapper
« Reply #35 on: June 23, 2025, 02:39:07 am »
Quote
I have done a little robot that just use this wrapper for continuous autonomous obstacle detection and object recognition.

Seems very interesting  8).

 

TinyPortal © 2005-2018