HavijMirza
Posts: 2
Joined: Tue Jun 15, 2021 2:26 am

HDMI2CSI Image processing problem

Tue Jun 15, 2021 2:46 am

Hi to all.
We are working on a project about HDMI processing.
our goal is to detect pixels or lines with certain criteria in the input frames
Problem is code works fine for either black or white pixels but not in between.how can we fix it?

Code: Select all

camera = PiCamera()
camera.resolution = (1280, 720)
camera.framerate = 25
camera.image_denoise = False
rawCapture = PiRGBArray(camera, size=(1280, 720))
# allow the camera to warmup
print("sleep for 5 seconds ...")
time.sleep(5)
i =0
# capture frames from the camera
for frame in camera.capture_continuous(rawCapture, format="rgb", use_video_port=True):
        # grab the raw NumPy array representing the image, then initialize the timestamp
        # and occupied/unoccupied text
        image = frame.array
        if i==10:
                print("Pixels after 10 rounds:", "\n")
                #show_pixels(image)
                #pil_image.save('hdmi_image.png')
                print(image[0,0])
                print(image[0,1])
                print(image[0,2])
                print(image[0,3])
                print(image[0,4])
                break
        i = i+1
____________________________________________________________________________________________________
camera = PiCamera()
camera.resolution = (1024, 768)
camera.framerate = 25
rawCapture = PiRGBAArray(camera)
# allow the camera to warmup
print("wait 5 seconds to warmup camera ...")
time.sleep(5)
i =0
# capture frames from the camera
for frame in camera.capture_continuous(rawCapture, format="bgra", use_video_port=True):
        # grab the raw NumPy array representing the image, then initialize the timestamp
        # and occupied/unoccupied text
        image = frame.array
        #-------------------------

        if i==10:
                print("Pixels after 10 rounds:", "\n")
                #show_pixels(image)
                #pil_image.save('hdmi_image.png')
                print(image[0,0])
                print(image[0,1])
                print(image[0,2])
                print(image[0,3])
                print(image[0,4])
                break
        i = i+1

__________________________________________________________________________
with picamera.PiCamera() as camera:
    with picamera.array.PiYUVArray(camera) as stream:
        camera.resolution = (1024, 768)
        camera.start_preview()
        time.sleep(2)
        camera.capture(stream, 'yuv')
        # Show size of YUV data
        print(stream.array.shape)
        # Show size of RGB converted data
        print(stream.rgb_array.shape)

        image = stream.rgb_array
        for i in range (0, 50):
                for j in range (0, image.shape[1]-1):
                        if (image[i,j,0]!=255):
                                print(i,image[i,j])
        print(image[0,0])
        print(image[0,1])
        print(image[0,2])
        print(image[0,3])
        print(image[0,4])
_______________________________________________________

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11473
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: HDMI2CSI Image processing problem

Wed Jun 16, 2021 8:20 am

The only results for HDMI2CSI from a search engine are for a TC358840 based board for Nvidia Tegra X1/X2 boards - https://blog.zhaw.ch/high-performance/c ... /hdmi2csi/

If you're referring to the TC358743 boards HDMI to CSI2 that work with the Pi, then the firmware based drivers (as used via picamera) are unsupported and are only provided as-is.
The V4L2 drivers are supported - see viewtopic.php?f=38&t=281972
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

HavijMirza
Posts: 2
Joined: Tue Jun 15, 2021 2:26 am

Re: HDMI2CSI Image processing problem

Sun Jun 20, 2021 6:13 pm

Thank you for your reaply.
I meant Auvidea b101
TC358743
https://auvidea.eu/product/70501/

Return to “Camera board”