Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 3989

Beginners • Re: warning message when reading .jpg file on RPi4b with cv2

$
0
0
Hi - and thanks for responding.

Thanks for the alternate way to display two images.

I went back and started entering my program a line at a time to verify it was working as expected. I started with the simple lines to import the cv2 library, convert to gray scale, and then display them both. This worked correctly. Both images were displayed.

I then imported the GPIO and time libraries and added the callback function for processing the button detect. This also worked. The two images were displayed and the button was detected and the LED lit correctly.

I then added the "while True:" loop for the background loop. This is where it all fell down! Only the color image was displayed. The button was still detected and processed correctly (the LED was lit) but only the color image was displayed. When I stopped the loop (with a <ctrl>+C), the color image disappeared, the button stopped being detected, and the gray image was displayed. The error seems to be related to the "while True:" loop and the interaction to the cv2 library elements.

Weird...

Statistics: Posted by starfire151a — Mon Oct 28, 2024 1:43 pm



Viewing all articles
Browse latest Browse all 3989

Trending Articles