Clear Filters
Clear Filters

Extract triangle with line features from images

2 views (last 30 days)
I have a collection of PNG image of synoptic weather chart which is in black and white. From each image, I would like to obtain the pixel coordinates of (1) the region identified by thick black curved lines with triangle markings and (2) thick dashed lines. Using Computer vision tools (bwmorph, bwareaopen and imerode) i was able to obtain approximate (green markings in second image) pixel coordinates but they are not exact. In some images, numbers and letters intersect with the above two regions I'm interested in. How can I remove the numbers and letters from the images? And how do i remove the thin black contour lines?
  2 Comments
DGM
DGM on 2 Mar 2024
I think even a human would have a hard time reliably identifying the different classes and extents of dashed lines in binarized images like that. It depends how many images you have and whether it's a recurring task. I'd be inclined to do it manually. If doing it manually, the binarization is probably something worth avoiding for sake of clarity, but I haven't seen the originals. This is particularly important if the coordinates you want are in physical/data space, not image space, since the grid labels are completely unreadable.
Sathish
Sathish on 3 Mar 2024
I have around 10k images, so doing it manually is a time consuming process. I have the relationship between the pixel coordinates and the grid coordinates. All I have to do is remove the pixel that has text (eg: L, H) / numbers (0-9), identify the regions of interest and get its pixel coordinates

Sign in to comment.

Answers (1)

Aishwarya
Aishwarya on 21 Mar 2024
Hi Sathish,
As per my understanding, you want to detect specific meteorological symbols and patterns while removing unwanted text that could interfere with the analysis.
To remove the text from the images I would suggest using a deep learning-based approach. This would also help easily process large quantities of images with different characteristics of the text.
Here is the workflow to perform text detection and removal:
  • You can use the "detectTextCRAFT" function, which is designed for detecting text in images. This function utilizes a Convolutional Neural Network (CNN) trained to identify text regions.
  • Here is a sample code that utilizes a sample image to detect and remove the text in the image.
% Read the image
img = imread("map.png");
% Detect text regions in the image
bboxes = detectTextCRAFT(img, "CharacterThreshold", 0.5);
% Display detected text regions
Iout = insertShape(img, "rectangle", bboxes, LineWidth=3, ShapeColor="blue");
figure;
imshow(Iout);
% Remove the detected text by covering it with white patches
IoutWithPatches = insertShape(img, "FilledRectangle", bboxes, 'Color', 'white', 'Opacity', 1);
figure;
imshow(IoutWithPatches);
The output here shows that most of the text has been removed from the map image.
This output image can then be used for further processing to identify the required features.
For more information about the "detectTextCRAFT" function, you can refer to the following documentation: https://www.mathworks.com/help/vision/ref/detecttextcraft.html
Hope this helps!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!