
example 2:

example 3:

result of example 1:

is it possible to detect an octagon shape and crop the image on that base ?!!
wha would the best method to isolate that number from the image ?
Code: Select all
convert 405_B.jpg -threshold 50% -bordercolor white -border 10 -fill black -draw "color 0,0 floodfill" -alpha off -shave 10x10 405_B_floodfill.gif
Code: Select all
convert 405_B_floodfill.gif -define connected-components:verbose=true -connected-components 4 405_B_objects.png
Code: Select all
convert 405_B_objects.png -define connected-components:area-threshold=12119 -connected-components 4 -auto-level -morphology erode octagon:1 405_B_objects_ccl.png
Code: Select all
[code]convert 405_B.jpg 405_B_objects_ccl.png -alpha off -compose copy_opacity -composite -trim +repage -background white -alpha background -alpha off 405_B_result.gif
Code: Select all
convert 423_B.jpg -threshold 50% -bordercolor white -border 10 -fill black -draw "color 0,0 floodfill" -alpha off -shave 10x10 423_B_floodfill.gif
convert 423_B_floodfill.gif -define connected-components:verbose=true -connected-components 4 423_B_objects.png
Code: Select all
convert 423_B_objects.png -define connected-components:area-threshold=11432 -connected-components 4 -auto-level -morphology erode octagon:1 423_B_objects_ccl.png
convert 423_B.jpg 423_B_objects_ccl.png -alpha off -compose copy_opacity -composite -trim +repage -background white -alpha background -alpha off 423_B_result.gif
OK. I will try to get to it later today. Perhaps you can find a Windows expert who can convert it to batch format.fraizor wrote:OK give me a code working for ubuntu and give me PM me your paypal so i could send the money ...
EDIT: i'am using the latest windows version.
yes. I do that all the timefraizor wrote:on ubuntu is it possible to run a bash script the i could give the image name and output name as a parameter when excuting the script ?
somthing like
bash im.sh input1.jpg output1.jpg
I have no idea. It depends upon your images. If they are all like the above, then it should be good. But I make no guarantees. So you can experiment with it first before paying. Let me know if it is satisfactory.fraizor wrote:btw: whast is the success rate of extracting the number ?
I am using IM 6.9.1.5 Q16 Mac OSX Snow Leopard. If you are not on a current version of IM that includes CCL, then my code will not work.fraizor wrote:i dont mind using any version i prefer the version that you have ..
Code: Select all
#/bin/bash
infile="$1"
outfile="$2"
inname=`convert "$infile" -format "%t" info:`
list=""
list=`convert "$infile" -threshold 50% -bordercolor white -border 10 \
-fill black -draw "color 0,0 floodfill" -alpha off -shave 10x10 \
-define connected-components:verbose=true -connected-components 4 ${inname}_objects.png`
thresh=`echo "$list" | tail -n +3 | head -n 1 | cut -d\ -f6`
convert "$infile" \
\( ${inname}_objects.png -define connected-components:area-threshold=$thresh -connected-components 4 \
-auto-level -morphology erode octagon:1 \) \
-alpha off -compose copy_opacity -composite \
-trim +repage -background white -alpha background -alpha off "$outfile"
rm -f ${inname}_objects.png
exit 0
Code: Select all
bash extract.sh 405_B.jpg 405_B_result.png
fraizor wrote:I'm downloading Ubuntu 15 now.
i just paste the code in a file and name it something .sh then run it right ?
Code: Select all
chmod u+x filename.sh
Code: Select all
bash filename.sh input output