This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

API solutions Forum

Part Number: PROCESSOR-SDK-AM69A
Other Parts Discussed in Thread: SK-AM69

Tool/software:

 In app_python I am able to display the camera imx219 in rectangle. I want it to be previewed camera 1 in triangle, and camera 2 in trapezoidal shape. using  ./apps_python/app_edgeai.py configs/imx219_cam_example.yaml

Next I want to stitch 2 cameras on end sides of 10% overlaping. Can you plz provide solution.

How to rotate the display preview to potrait and landscape.

90 deg , 180 deg, 270 deg and 360 deg output shifted. if possible.

Thanks in advance.

  • Hi Ruban,

    Could you clarify what you mean by previewing a camera in triangle/trapezoidal shape? Do you have any examples you could provide?

    If you would like to make changes to the configuration file such as the number of camera inputs and the placement of each camera stream on your display when running ./apps_python/app_edgeai.py configs/imx219_cam_example.yaml, see: https://software-dl.ti.com/jacinto7/esd/processor-sdk-linux-am69a/10_00_00/exports/edgeai-docs/common/configuration_file.html

    The configuration file allows you to define the mosaic coordinates as well as width and height, but there is no field for rotation. The out of box applications such as the one you are using, take the information from the config file to generate a GStreamer pipeline. When you quit the application, you can see this pipeline in the terminal. You can copy the pipeline and add a rotation element to achieve your desired output.

    Here is an example pipeline that uses this rotation element. The angle by which the picture is rotated is in radians.

    gst-launch-1.0 -v videotestsrc ! rotate angle=0.78 ! videoconvert ! autovideosink

    For more GStreamer pipeline examples, see:

    FAQ: https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1427869/faq-sk-am69-how-to-stream-from-csi-sensor-to-display-using-gstreamer

    Edge AI dataflows: https://software-dl.ti.com/jacinto7/esd/processor-sdk-linux-am69a/10_00_00/exports/edgeai-docs/common/edgeai_dataflows.html

    Thank you,

    Fabiana

  • Thanks for the reply. Provide data is useful. I would like to get more information on the below.

    In python   connected 4 camera and this is the preview. the output is in 4 triangles shape and stitched. The python code using opencv and this is using usb . i wanted using CSI for this SK-AM69 board with imx219 camera.

    The code for tringle shape is 

    # Define masks for isosceles triangular areas
    left_mask = np.zeros((canvas_height, canvas_width // 2), dtype=np.uint8)
    pts_left = np.array([[0, canvas_height], [0, 0], [canvas_width // 2, canvas_height // 2]], dtype=np.int32)
    cv2.fillPoly(left_mask, [pts_left], 255)

    right_mask = np.zeros((canvas_height, canvas_width // 2), dtype=np.uint8)
    pts_right = np.array([[canvas_width // 2, 0], [canvas_width // 2, canvas_height], [0, canvas_height // 2]],
    dtype=np.int32)
    cv2.fillPoly(right_mask, [pts_right], 255)

    the code for masking is 

    # ruban for top mask
    output_frame[0:400, 0:400] = masked_frame_top[:, :400] + masked_frame_left[:400, :] # ruban top left corner

    output_frame[0:400, 400:800] = masked_frame_top[:, 400:800] + masked_frame_right[:400, :] # ruban top right corner

    # ruban for bottom mask
    output_frame[400:800, 0:400] = masked_frame_bottom[:, :400] + masked_frame_left[400:800, :] # ruban bottom left corner

    output_frame[400:800, 400:800] = masked_frame_bottom[:, 400:800] + masked_frame_right[400:800, :] # ruban bottom right corner

    this I wanted in out of box config box to run in ./apps_python/app_edgeai.py configs/imx219_cam_example.yaml now the output of mosaic provides only position and rectangle.I want to reshape kindly provide solution as above image ASAP.

    Thanks in Advance.
  • Hi Ruban,

    I recommend taking a look at apps_python directory to understand how the python based application works and make the changes needed to meet your use case.

    Thank you,

    Fabiana

  • I have looked on apps_python. The issue i am facing is that. Input is taken from config file. then it is passed to main python then to post process. but the problem is the mosaic coordinates it has only 4 parameter in which v,w is the coordinates point and x,y is the diemension . no matter what i hve done it takes is rectangle shape. Kindly provide one example to change the dimension to triangle shape remaining I can take care

    Thanks in advance

  • Hi Ruban,

    Reshaping the input in this way is not supported out of box. We cannot help with developing your python application, but I can suggest a way you can use GStreamer to help you achieve your desired result. You could rotate the image and then crop the unwanted corner out using rotate and videocrop GStreamer elements.

    Rotate:
    gst-launch-1.0 -v videotestsrc ! rotate angle=0.78 ! videoconvert ! autovideosink
    
    Video Crop:
    gst-launch-1.0 -v videotestsrc ! videocrop top=42 left=1 right=4 bottom=0 ! ximagesink
    
    Rotate + Video Crop:
    gst-launch-1.0 -v videotestsrc ! rotate angle=0.78 ! videoconvert ! videocrop top=42 left=1 right=4 bottom=0 ! autovideosink

    These example launch pipelines are taken from the GStreamer website, so you will have to adjust these values to meet your target. There may be GStreamer elements that are better suited for your need but these are simple ones I know of that you could use.

    Thank you,

    Fabiana

  • Thanks for the support

    Rotate:
    gst-launch-1.0 -v videotestsrc ! rotate angle=0.78 ! videoconvert ! autovideosink - working

    Video Crop:
    gst-launch-1.0 -v videotestsrc ! videocrop top=42 left=1 right=4 bottom=0 ! ximagesink - WARNING: erroneous pipeline: no element "ximagesink"

    Rotate + Video Crop:
    gst-launch-1.0 -v videotestsrc ! rotate angle=0.78 ! videoconvert ! videocrop top=42 left=1 right=4 bottom=0 ! autovideosink - differet place its working

    Only color lines is visible. Required camera imx219 preview to be made how to configure for 

        input0:
            source: /dev/video-imx219-cam0
            subdev-id: /dev/v4l-imx219-subdev0
            width: 1920
            height: 1080
            format: rggb
            framerate: 30
    and how to run with 2 camera preview. Kindly provde solution ASAP
  • Hi Ruban,

    The first two pipelines I shared were example pipelines taken directly from the GStreamer website to give you an idea on how the rotate and video crop elements can be used in the pipeline that you develop. I used the two elements in a single pipeline to demonstrate how they can be used at once. I also shared this FAQ in my initial response which provides basic GStreamer pipelines that use a camera input and output the stream to a display. You can use these resources as a starting point when developing the pipeline needed to meet your use case.

    Thank you,

    Fabiana