PureBasic Interface to OpenCV

Developed or developing a new product in PureBasic? Tell the world about it.
acreis
Enthusiast
Enthusiast
Posts: 204
Joined: Fri Jun 01, 2012 12:20 am

Re: PureBasic Interface to OpenCV

Post by acreis »

Hi JHPJHP,

That's correct. The error remains in every cvResize() call, in every example.

I apreciate your support and I'll report any news.

Thank you

AReis
User avatar
JHPJHP
Addict
Addict
Posts: 2251
Joined: Sat Oct 09, 2010 3:47 am

Re: PureBasic Interface to OpenCV

Post by JHPJHP »

Hi acreis,
acreis wrote:That's correct. The error remains in every cvResize() call, in every example.
Does the error occur as soon as the example is run or when a new image is selected?

If the latter, what happens if you change the default image to one that previously failed?
- change the last line of code: OpenCV("images/seams1.jpg")

My thoughts:
- this has nothing to do with the function cvResize beyond it requiring a definitive amount of memory
- after the initial run the memory is not correctly released (error points to the C run-time files)

I can duplicate the error you're receiving using a combination of a very large image with the function OpenFileRequester; the system crashed when the code reached the function cvResize. I modified the code not to use this function, and it still crashed at the next memory intensive function.

Have you tried a previous version of the following C Runtime files or uninstalling any previous versions?
- msvcp120.dll, msvcr120.dll

Other things to try / consider:
- can you reproduce the error on a second computer
- do you have the latest download
- have you tried the version OpenCV 3.0 32bit
Last edited by JHPJHP on Sat Oct 17, 2015 5:24 pm, edited 3 times in total.

If you're not investing in yourself, you're falling behind.

My PureBasic StuffFREE STUFF, Scripts & Programs.
My PureBasic Forum ➤ Questions, Requests & Comments.
AAT
Enthusiast
Enthusiast
Posts: 259
Joined: Sun Jun 15, 2008 3:13 am
Location: Russia

Re: PureBasic Interface to OpenCV

Post by AAT »

Hi acreis,
How much RAM in your computer?
acreis
Enthusiast
Enthusiast
Posts: 204
Joined: Fri Jun 01, 2012 12:20 am

Re: PureBasic Interface to OpenCV

Post by acreis »

Hi AAT,

I apreciate your help about this issue.

I have access to that desktop computer only monday to friday, 9 to 5.

Then, I'll make some tests next week and I'll post the news.

Thank you very much.

ACReis
AAT
Enthusiast
Enthusiast
Posts: 259
Joined: Sun Jun 15, 2008 3:13 am
Location: Russia

Re: PureBasic Interface to OpenCV

Post by AAT »

Hi,
i've got an error in example cv_inpaint.pb with very large image 19712x13056 pix 24 bit http://rghost.ru/private/7PdT5JGQF/20b0 ... 07afc614ec

Image

WindowsXP 32 bit, RAM=2GByte, OpenCV 2.4.11, msvcp120.dll, msvcr120.dll
Errors weren't with images of the smaller sizes.
User avatar
JHPJHP
Addict
Addict
Posts: 2251
Joined: Sat Oct 09, 2010 3:47 am

Re: PureBasic Interface to OpenCV

Post by JHPJHP »

Hi AAT,

See this post: http://www.purebasic.fr/english/viewtop ... 48#p474548
- open an image without the function OpenFileRequester

You can test this by changing the default image to one that previously failed.
- last line of code: OpenCV( [ path to image here ] )
- http://www.purebasic.fr/english/viewtop ... 10#p474610

If you're not investing in yourself, you're falling behind.

My PureBasic StuffFREE STUFF, Scripts & Programs.
My PureBasic Forum ➤ Questions, Requests & Comments.
AAT
Enthusiast
Enthusiast
Posts: 259
Joined: Sun Jun 15, 2008 3:13 am
Location: Russia

Re: PureBasic Interface to OpenCV

Post by AAT »

Hi, JHPJHP!
You are right, there is no error if i start the program with this large image as a default image... :oops:
acreis
Enthusiast
Enthusiast
Posts: 204
Joined: Fri Jun 01, 2012 12:20 am

Re: PureBasic Interface to OpenCV

Post by acreis »

Hi,

I have set up a VMBOX with 192 MB RAM Windows Xp SP3 32bits

All examples run fine Please note the small amount of Ram

I think some particular config of hardware/softare is responsible by the issue I reported before, not RAM amount

I'll keep you updated about my investigation

Thanks

Acreis
acreis
Enthusiast
Enthusiast
Posts: 204
Joined: Fri Jun 01, 2012 12:20 am

Re: PureBasic Interface to OpenCV

Post by acreis »

Hi AAT,

The desktop config is: Intel Core i5-650 / 3GB RAM.

There is a lot of versions of msvc run time libraries in folder Windows\System32, including version 12.

This is a corporate computer with very restritive policies, but I have compiled and run successfuly many purebasic programs, after excluding my working folder of being verified by symantec antivirus.

I'll keep you updated about any progress in this issue.

Thanks

ACReis
User avatar
JHPJHP
Addict
Addict
Posts: 2251
Joined: Sat Oct 09, 2010 3:47 am

Re: PureBasic Interface to OpenCV

Post by JHPJHP »

Updated:
- modified a filter in the stitching examples producing a sharper final image
-- le_stitching_1.pb, le_stitching_2.pb
- added a new example
-- cv_steganography.pb


Steganography is the practice of concealing a file, message, image, or video within another file, message, image, or video.

There are many ways to approach this...

I chose to conceal text in an image by slightly changing pixel colors at a set increment. The pixel variance is calculated using (Ascii-Table) decimal values derived from a predefined message, then added / removed to the RGB set. By comparing the modified image to the original image the encrypted text can be extracted.

- the default image or any new images loaded using the context menu will be recalculated to include the changed pixels
- press the spacebar to decrypt the changed pixels, revealing the concealed text in notepad

If you're not investing in yourself, you're falling behind.

My PureBasic StuffFREE STUFF, Scripts & Programs.
My PureBasic Forum ➤ Questions, Requests & Comments.
User avatar
JHPJHP
Addict
Addict
Posts: 2251
Joined: Sat Oct 09, 2010 3:47 am

Re: PureBasic Interface to OpenCV

Post by JHPJHP »

Updated:
- added 1 example
-- cv_color_transfer.pb: performs a color transfer between two images

Based on script found here.

This example is a nice compliment to cv_pseudo_colors.pb.
- cv_color_transfer.pb: use the context-menu [ Open ] to change the filter, press Spacebar to see original image
- cv_pseudo_colors.pb: use the context-menu [ Open ] to change the main image, press Spacebar to switch between 3 image filters

NB*: I came by this example looking for a solution to equalize colors across multiple images to enhance the stitching examples. Based on some initial testing it seems to be a good start.

If you're not investing in yourself, you're falling behind.

My PureBasic StuffFREE STUFF, Scripts & Programs.
My PureBasic Forum ➤ Questions, Requests & Comments.
User avatar
JHPJHP
Addict
Addict
Posts: 2251
Joined: Sat Oct 09, 2010 3:47 am

Re: PureBasic Interface to OpenCV

Post by JHPJHP »

Updated:
- the following examples have been modified
-- cv_cam_logo.pb, cv_color_transfer.pb, cv_inpaint.pb, cv_norm.pb

Most notably the example cv_inpaint.pb has been rewritten to better showcase its use.
- default image opens with 20 randomly placed simulated "scratches" (white lines)
- use the [ < / > KEYS ] to adjust the inpaint size (cannot be used after pressing the Spacebar)
- use the [ I KEY ] to toggle the inpainting method (should be done before manually marking areas, cannot be used after pressing the Spacebar)
- use the mouse pointer to manually mark additional areas for correction (cannot be used after pressing the Spacebar)
- press the Spacebar the first time to mark the scratched areas, press it a second time to correct the scratched (marked) areas
- press the enter key at any time to reset the image, adding a new set of randomly placed simulated scratches

In a real-world application the detection method would be automated using various filters.

NB*: The larger the inpaint size the more noticeable the correction.

If you're not investing in yourself, you're falling behind.

My PureBasic StuffFREE STUFF, Scripts & Programs.
My PureBasic Forum ➤ Questions, Requests & Comments.
AAT
Enthusiast
Enthusiast
Posts: 259
Joined: Sun Jun 15, 2008 3:13 am
Location: Russia

Re: PureBasic Interface to OpenCV

Post by AAT »

Hi, JHPJHP,
Thank you for your new examples!

I tested the example cv_steganography.pb, it incorrectly works for me.
The problem is in ExtractText procedure:

Code: Select all

...
  hWnd = FindWindow_(#Null, "Untitled - Notepad")
...
In my version of Windows with Russian language this line should be

Code: Select all

...
  hWnd = FindWindow_(#Null, "Безымянный - Блокнот")
...
I think the same problem will take place in Windows with others not English languages.

Good luck!
User avatar
RSBasic
Moderator
Moderator
Posts: 1228
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: PureBasic Interface to OpenCV

Post by RSBasic »

Maybe this code?

Code: Select all

...
  hWnd = FindWindow_("notepad", #Null)
...
Or EnumWindows_().
Image
Image
AAT
Enthusiast
Enthusiast
Posts: 259
Joined: Sun Jun 15, 2008 3:13 am
Location: Russia

Re: PureBasic Interface to OpenCV

Post by AAT »

RSBasic,

Code: Select all

hWnd = FindWindow_("notepad", #Null)
it works, thanks!

Good luck!
Locked