Page 53 of 60
Re: PureBasic Interface to OpenCV
Posted: Fri Jan 12, 2018 8:37 am
by mcederavic
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!
Re: PureBasic Interface to OpenCV
Posted: Fri Jan 12, 2018 1:40 pm
by AAT
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: Select all
Procedure ResolutionList(MaxWidth = 1280, nInterval = 100)
to
Code: Select all
Procedure ResolutionList(MaxWidth = 2592, nInterval = 162)
Re: PureBasic Interface to OpenCV
Posted: Fri Jan 12, 2018 2:05 pm
by mcederavic
Hello AAT,
Thanks for your reply, unfortunately it did not change. Available resolutions are still 640x360 or 1280x960
Re: PureBasic Interface to OpenCV
Posted: Fri Jan 12, 2018 3:06 pm
by AAT
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: Select all
*capture = cvCreateCameraCapture(#CV_CAP_ANY)
to
Code: Select all
*capture = cvCreateCameraCapture(1)
or other number, not 0
Re: PureBasic Interface to OpenCV
Posted: Fri Jan 12, 2018 6:14 pm
by mcederavic
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
Re: PureBasic Interface to OpenCV
Posted: Fri Jan 12, 2018 8:28 pm
by JHPJHP
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)
Re: PureBasic Interface to OpenCV
Posted: Sat Jan 13, 2018 3:46 am
by AAT
mcederavic, read this topic
http://www.purebasic.fr/english/viewtop ... 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.
Re: PureBasic Interface to OpenCV
Posted: Mon Jan 15, 2018 10:34 am
by mcederavic
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!
Re: PureBasic Interface to OpenCV
Posted: Thu Feb 08, 2018 4:32 pm
by Morty
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/tessda ... raineddata
After that I copied the file into the folder "binaries\tesseract\tessdata" and changed it in the sourcecode
Code: Select all
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: Select all
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
Re: PureBasic Interface to OpenCV
Posted: Thu Feb 08, 2018 6:25 pm
by JHPJHP
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.
Re: PureBasic Interface to OpenCV
Posted: Fri Feb 09, 2018 8:43 am
by Morty
Good morning JHPJHP,
I thank you a thousand times
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?
- Morty
Re: PureBasic Interface to OpenCV
Posted: Sat Feb 10, 2018 6:56 am
by JHPJHP
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.
Re: PureBasic Interface to OpenCV
Posted: Mon Feb 12, 2018 10:00 am
by Morty
Good morning,
I've send you a few dollars for coffee
Thank you again and have a nice day.
- Morty
Re: PureBasic Interface to OpenCV
Posted: Wed Feb 21, 2018 6:23 pm
by JHPJHP
Hi Morty,
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
Re: PureBasic Interface to OpenCV
Posted: Tue Apr 17, 2018 8:21 pm
by JHPJHP
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.