hi all...
can somebody briefly explain what is the fastest way to delete the lines around the date and time in this image using the command line:
thanks...
delete a line or two..
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: delete a line or two..
If you know the coordinates of the ends, IM could paint quickly over them. Finding those coordinates in the general case wouldn't be trivial.
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: delete a line or two..
if this is a one-time thing, then it would be best to use a gui tool such as Photoshop or GIMP to paint over the lines with white.
Re: delete a line or two..
aware. thanks. any idea of how would that work?snibgo wrote:Finding those coordinates in the general case wouldn't be trivial.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: delete a line or two..
You'd have to examine a few examples to determine commonality. For example:
- Trim off surrounding white space.
- Is the date/time always in approximately the same position? Then crop everthing else away.
- Are the lines usually/always thicker than the letters? Then morphology erode will erode them first.
- Use "compare" to look for large patches of white space. This gives x-coordinates where the lines are not present.
- Trim off surrounding white space.
- Is the date/time always in approximately the same position? Then crop everthing else away.
- Are the lines usually/always thicker than the letters? Then morphology erode will erode them first.
- Use "compare" to look for large patches of white space. This gives x-coordinates where the lines are not present.
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: delete a line or two..
I tried morphology with no success.
Re: delete a line or two..
thanks snibgo....
date and time a kinda in the same place but not really. sometimes not too close.
actually the lines are thinner then the letters.
i'll play with the compare you are mentioning although it seems to me like a long shot...
is there a way for imagemagick to detect anything else that is not a letter and that way get it's coordinates?
thanks...
date and time a kinda in the same place but not really. sometimes not too close.
actually the lines are thinner then the letters.
i'll play with the compare you are mentioning although it seems to me like a long shot...
is there a way for imagemagick to detect anything else that is not a letter and that way get it's coordinates?
thanks...
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: delete a line or two..
For this particular image, moo.jpg, IM can readily find the horiontal lines. Use a search pattern (say) 10 pixels wide, and six high. Make lines 0, 1, 4 and 5 white; lines 2 and 3 black.
compare -metric RMSE moo.jpg search.png found.png
Threshold found.jpg [edit: I mean found.png] about 66%, and it will be white where the search was found (ie the tops of the roughly horizontal lines) and black otherwise.
The vertical lines on moo.jpg aren't clean, so that technique wouldn't work there. Instead, you could find the limits of the white lines in found.png, and just assume the vertical lines are between those.
compare -metric RMSE moo.jpg search.png found.png
Threshold found.jpg [edit: I mean found.png] about 66%, and it will be white where the search was found (ie the tops of the roughly horizontal lines) and black otherwise.
The vertical lines on moo.jpg aren't clean, so that technique wouldn't work there. Instead, you could find the limits of the white lines in found.png, and just assume the vertical lines are between those.
Last edited by snibgo on 2010-04-15T15:33:29-07:00, edited 1 time in total.
snibgo's IM pages: im.snibgo.com
Re: delete a line or two..
let me see if i understand this correctly. i need to create a search.png that has the same lines as they appear in the image? and then compare the two images to basically "cancel" out the lines in the main image?snibgo wrote:compare -metric RMSE moo.jpg search.png found.png
if this is true i can try to do that. as a proof of concept but since these images would be scanned and maybe coming off cameras the box's dimensions may vary. maybe not drastically but enough to trow the comparison off..
does this make sense?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: delete a line or two..
Yes, that's it. That's why you need to find commonalities between source images. "compare" will find "similar" matches, hence my cut-off at 66% will finds lines that are shorter than 10 pixels, or are slightly diagonal, etc. Reduce that number to far, and you will get false positives.
If the input images vary greatly, you might need to change your strategy (eg search for diagonal or vertical lines).
If the input images vary greatly, you might need to change your strategy (eg search for diagonal or vertical lines).
snibgo's IM pages: im.snibgo.com