PureBasic Forum
https://www.purebasic.fr/english/

PureBasic Interface to OpenCV
https://www.purebasic.fr/english/viewtopic.php?f=12&t=57457
Page 53 of 57

Author:  mcederavic [ Fri Jan 12, 2018 8:37 am ]
Post subject:  Re: PureBasic Interface to OpenCV

Hello JHPJHP,
First of all, thanks a lot for your work, i'm using it to take photo with an integrated webcam of a HP Tablet but i have a problem to change the resolution.
The webcam is capable of streming in 1080p and can take 5mp photo (rear cam OV5670, wich works great with windows camera app) but whenever I try a resolution above 1280x960 it falls back to it.
The example "pb_webcam_resolution.pb" actually shows that the max resolution is 1280x960 but the windows camera app can take photo above that.
I tried to set FOURCC with MJPG or YUY2 but it didn't help.
Have you an idea?

Thanks!

Author:  AAT [ Fri Jan 12, 2018 1:40 pm ]
Post subject:  Re: PureBasic Interface to OpenCV

Hi JHPJHP!
Sorry, I will try to answer the question posed to you.

Hi, mcederavic.
Your OV5670 have 2592*1944 image size (max).

So, in the exmple pb_webcam_resolution.pb try to change
Code:
Procedure ResolutionList(MaxWidth = 1280, nInterval = 100)

to
Code:
Procedure ResolutionList(MaxWidth = 2592, nInterval = 162)

Author:  mcederavic [ Fri Jan 12, 2018 2:05 pm ]
Post subject:  Re: PureBasic Interface to OpenCV

Hello AAT,
Thanks for your reply, unfortunately it did not change. Available resolutions are still 640x360 or 1280x960

Author:  AAT [ Fri Jan 12, 2018 3:06 pm ]
Post subject:  Re: PureBasic Interface to OpenCV

mcederavic, specify the exact name of your HP Tablet, please.

I think, your tablet have two cams and you trying to set high resolution to cam with low resolution, forexample, to front cam.
Add one more change to example: change the cam number
Code:
  *capture = cvCreateCameraCapture(#CV_CAP_ANY)

to
Code:
  *capture = cvCreateCameraCapture(1)

or other number, not 0

Author:  mcederavic [ Fri Jan 12, 2018 6:14 pm ]
Post subject:  Re: PureBasic Interface to OpenCV

Yes I took the rear cam (and I see the rendered preview in the window)
The tablet is a HP Notebook x2 - 10-p028nf

I tried to capture in 1920x1080 with VLC but it fail to initialize too... I'm wondering if it is a hardware / driver lock

Author:  JHPJHP [ Fri Jan 12, 2018 8:28 pm ]
Post subject:  Re: PureBasic Interface to OpenCV

Hi mcederavic,

Try the following: ... OpenCV access webcam maximum resolution
- set the resolution to something larger (e.g. 3000x3000)
stackoverflow wrote:
I got it to work, so this post is for others experiencing the same problem:

I am running on the Logitech C270 as well. For some reason it would only show 640x480 even though the webcam supports 1280x720. Same issue persists with the built-in webcam in my laptop.

If I set it to 800x600 in the code it shows 640x480. However, if I set it to 1024x768 it becomes 800x600. And if I set it to something silly like 2000x2000 it becomes 1280x720.

This is in C++ on OpenCV 3.0, but perhaps it applies to Python as well.

If you are live streaming from your tablet, have you looked at the FFMPEG / RTSP example.

You may also want to try a different version of the download: PureBasic Interface to OpenCV 2.4.13.3 vs PureBasic Interface to OpenCV 3.3.
- OpenCV 3.3 was built using the World option (single DLL / LIB)

Author:  AAT [ Sat Jan 13, 2018 3:46 am ]
Post subject:  Re: PureBasic Interface to OpenCV

mcederavic, read this topic viewtopic.php?f=12&t=69059
Download opencv libs with reordered mediaSubtypes from http://rgho.st/84FfzcJrp
Replace the opencv libraries from the JHPJHP package with downloaded ones and try your code again.

Author:  mcederavic [ Mon Jan 15, 2018 10:34 am ]
Post subject:  Re: PureBasic Interface to OpenCV

Hello AAT / JHPJHP

I tried both OpenCV 2.4.13 and 3.3 and got same results. I also tried all known resolution and iterating up to 8192x8192 one by one but the max alowed is always 1288x960 event with the reordered lib.
I will try with an external usb cam.
Thanks for your help!

Author:  Morty [ Thu Feb 08, 2018 4:32 pm ]
Post subject:  Re: PureBasic Interface to OpenCV

Hi JHPJHP,

thanks for these great codes and for your work.

I have a problem with tesseract and german traineddata. I downloaded this file:
https://github.com/tesseract-ocr/tessdata/blob/master/deu.traineddata

After that I copied the file into the folder "binaries\tesseract\tessdata" and changed it in the sourcecode
Code:
hAPI = TesseractInit(#PSM_AUTO, #OEM_TESSERACT_ONLY, #PB_Compiler_FilePath + "binaries/tesseract/tessdata", "deu", #Null$)


If I run the code I get an memory-error (Read-Error ad Address 0) in pb_tesseract.pbi - Line 104
Code:
 If TessBaseAPIInit1(hAPI, dictionarypath, language, OEM, @CFG, 1) : TessBaseAPIEnd(hAPI) : Else : ProcedureReturn hAPI : EndIf


It seems, that there is a conflict with the traineddata file. Am I missing something?
Do you have a suggestion?

Thanks,
Morty

Author:  JHPJHP [ Thu Feb 08, 2018 6:25 pm ]
Post subject:  Re: PureBasic Interface to OpenCV

Hi Morty

The problem is with the traineddata version; try the following link:
- Data Files for Version 3.02

Another option is to replace the binaries with the current version, but then you may also have to update the code.

Author:  Morty [ Fri Feb 09, 2018 8:43 am ]
Post subject:  Re: PureBasic Interface to OpenCV

Good morning JHPJHP,

I thank you a thousand times :D With these files it works. I only wonder a bit, because the german files are much smaller than the origin english wone.
Where is the donation button? 8)

- Morty

Author:  JHPJHP [ Sat Feb 10, 2018 6:56 am ]
Post subject:  Re: PureBasic Interface to OpenCV

Hi Morty,

I am glad I was able to help. It is nice to know that the interface has found an audience.

Morty wrote:
... I only wonder a bit, because the german files are much smaller than the origin english wone.

Sorry, I cannot find any documentation on why the file sizes are so different, but it is standard across versions.

Morty wrote:
Where is the donation button?

Not necessary, but if you still want to buy me a coffee... My PureBasic Stuff - Unfinished (website) located in the footer of my posts, has a Donate button.

Author:  Morty [ Mon Feb 12, 2018 10:00 am ]
Post subject:  Re: PureBasic Interface to OpenCV

Good morning,

I've send you a few dollars for coffee ;-)

Thank you again and have a nice day.

- Morty

Author:  JHPJHP [ Wed Feb 21, 2018 6:23 pm ]
Post subject:  Re: PureBasic Interface to OpenCV

Hi Morty,

Quote:
Good morning,

I've send you a few dollars for coffee ;-)

Thank you again and have a nice day.

- Morty

I just noticed that you had not read my PM, and I wanted you to know that I am grateful for the coffee.

Cheers :!:

Author:  JHPJHP [ Tue Apr 17, 2018 8:21 pm ]
Post subject:  Re: PureBasic Interface to OpenCV

Updated: ( OpenCV 2.4.13.3 to OpenCV 2.4.13.6 )
- Demo Download: PureBasic Interface to OpenCV :: 32 bit
- Main Download: PureBasic Interface to OpenCV :: 32 bit
- Demo Download: PureBasic Interface to OpenCV :: 64 bit
- Main Download: PureBasic Interface to OpenCV :: 64 bit

Other Changes:
- replaced reference files
- removed 4 examples (might be temporary)
- removed MS Runtime DLLs (users with an older version of Windows may need to provide their own)

NB*: When time permits, I will be updating the rest of the packages.

Page 53 of 57 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/