Converting multi-line image to array based on intensity of the line

Sairath Bhattacharjya 47 Reputation points
2024-03-13T15:11:17.8966667+00:00

Hello everyone, I am new to computer vision. I am working on a project where I am trying to read a part of an image and converting the image into an array depending on the intensity of the line. Here is an example

User's image

We want to detect how intense the line is, and make determinations accordingly. The intensity value along with thresholds would help identify if the value indicated by the line is a true or false. Is there a way I can use Azure AI Vision to accomplish what I am trying to do? TIA

Azure Computer Vision
Azure Computer Vision
An Azure artificial intelligence service that analyzes content in images and video.
338 questions
0 comments No comments
{count} votes

Accepted answer
  1. YutongTie-MSFT 48,001 Reputation points
    2024-03-13T22:25:56.7933333+00:00

    @Sairath Bhattacharjya

    Thanks for reaching out to us, you can use Azure Computer Vision to analyze images. However, extracting the intensity of a specific line in an image and converting it into an array is a bit complex and may require additional image processing techniques. Azure Computer Vision may not be able to accomplish it directly.

    Azure Computer Vision can identify, tag, and classify general features in an image, but it doesn't provide granular control to measure the intensity of specific lines within an image. For your specific requirement, you might need to use a more advanced image processing library like OpenCV along with a programming language like Python. OpenCV (Open Source Computer Vision Library) can help you process images and perform operations like edge detection, intensity measurement, etc. Here's a rough example of how you could accomplish this with OpenCV in Python but only for reference:

    import cv2  
    import numpy as np  
      
    # Load the image in grayscale  
    img = cv2.imread('your_image.png', 0)  
      
    # Threshold the image to binary based on intensity  
    ret, thresh = cv2.threshold(img,127,255,cv2.THRESH_BINARY)  
      
    # Convert image to array  
    img_array = np.array(thresh)  
      
    # Now img_array holds the intensity of each pixel  
    

    In this code, 'your_image.png' would be the file path to your image. The threshold function converts the grayscale image into a binary image. The second parameter '127' is the threshold value, and '255' is the value to give if the pixel value is more than the threshold value.

    For more complex tasks like line detection, you would need to use additional techniques like Hough Line Transform or Canny Edge Detection which are also available in OpenCV.

    I hope this provides some clues to you.

    Regards,

    Yutong

    -Please kindly accept the answer if you feel helpful to support the community, thanks a lot.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful