Image processing/raspberry python problems

Hello.
Background:
we wrote our image processing (vision) in Python(2.4) using opencv(cv2) and alittle help from Numpy. We decided to run our script on a raspberry pi (2 model b) which gets its power from the roborio and the camera is connected straight to the pi.
The problem:
When we run the script on the pi it starts off without problems (finds contours and returns the image it took so we can review it) but it gradually gets worse - the image it saves becomes brighter until its completely white and the size of the file weighs less and less until it hits 1KB (white image).
Only resetting the Pi makes the code return values again until it hits 1KB image again.
We switched out 3 cameras to rule out the option that the camera is the source of trouble. we ran the script on our Laptop to see if it still happens and it didn’t (!) so I think the problem is not in the code because its running perfectly fine on the Laptop.
I wanted to know if the problem might be happening because the free memory on the pi is filling while we run the code so to check that I checked the free space, ran the code until the image is white, checked the space again and saw we didn’t fill much space so it can’t be the issue (Might it be the RAM? I don’t think so).
So… If its not the camera, free space or the code, what might it be?

It’s almost certainly the code. Post it and maybe we can help you diagnose it.

Why are you using python 2.4? That’s incredibly ancient.

im not the one who wrote the code and we will send it tomorrow,
the thing is, it does work when we run it on the laptop but when we run it on the pi it begin to white out. to the why ywe use 2.4 i have no idea and again will send it tomorrow, thank you

Sounds like a camera setting (or settings) are messing up in self adjustment. An approach to solve this which I have done in the past is to adjust the V4L(2) settings for your camera at runtime.

And 2.4? Come on, 2.7 is where it’s at…

we found the solution, the vision team who wrote the code opened the camera inside the loop which made some problems