curwidth & height
aferriss opened this issue · 9 comments
Hi,
I think the curwidth and curheight and reversed on line 34 and line 40...?
switched them and seems to be working fine for me now. Thanks!
Hello,
Can you further explain what the problem is ? It's been working up to now without any changes..
When I tried to run the program to hide an image it would give me an error saying that the index was out of bounds. I think the y value goes first on some cv mats, so switching the x and y seemed to solve the issue. Using opencv 2.4.9 fwiw.
Humm, it's weird. If you can upload one of the image on which it fails so that I can try. It would be weird that the order of width height change from on version to another of OpenCV. I will give it a look, but if you have a test file it could be cool..
Ok, someone has already mentioned this problem. I can send you the test file if you need.
I fixed this issue in my pull request #4, I've coded against opencv version 2.4.11_1.
Indeed. The indices height and width were mixed up. I don't know if this changed >=2.4.11_1 or <2.4.11_1.
Can someone verify?
Tried both versions and I got the same error as @aferriss using @RobinDavid's version on Ubuntu:
OpenCV Error: One of arguments' values is out of range (index is out of range) in cvPtr2D, file /build/buildd/opencv-2.4.8+dfsg1/modules/core/src/array.cpp, line 1797
Traceback (most recent call last):
File "script.py", line 8, in <module>
steg.hideImage(imagetohide)
File "/home/pablo/Proyectos/LSB-Steganography-master/LSBSteg.py", line 145, in hideImage
self.putBinaryValue(self.byteValue(int(val)))
File "/home/pablo/Proyectos/LSB-Steganography-master/LSBSteg.py", line 56, in putBinaryValue
val = list(self.image[self.curwidth,self.curheight]) #Get the pixel value as a list
cv2.error: index is out of range
Images used were this to hide in this one.
Finally, I downloaded this blob from @Buggaboo's pull request and it works perfectly 👍
ADDENDUM
It works, but I only tried using the code in the README.md file; seems that using the comands crashes.
This is the error that I get when trying python LSBSteg.py -steg-image steg.jpg -out bin
using the result of python LSBSteg.py -image image.jpg -binary binary.bin -steg-out steg.jpg
where binary.bin
is a base64 encoded image of the "secret" image:
Traceback (most recent call last):
File "LSBSteg.py", line 242, in <module>
main(av)
File "LSBSteg.py", line 236, in main
binary_steg_reveal(args.steg_image, args.out)
File "LSBSteg.py", line 212, in binary_steg_reveal
bin = steg.unhideBin()
File "LSBSteg.py", line 194, in unhideBin
for i in range(l):
MemoryError
Hi @pabloriutort ! I have just merged the pull request from @Buggaboo to fix the first issue. For the second I guess this is the numpy running under the hood that is raising the MemoryError
but I couldn't get to understand why. Does your image were especially big ?
Hello @RobinDavid. The image is now attached to this comment, but you can also find it on my previous comment. And yes, the image is pretty big with 1,24 MB (maybe another issue?).
If the issue is now solved, feel free to reject my pull request.
Problem now fixed with refactoring