[HELP] Autocrop batch on photo ID
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: [HELP] Autocrop batch on photo ID
This does not finish for me on IM 6.6.9.7. So I think your version of IM is faulty.
compare -metric rmse -subimage-search -dissimilarity-threshold 100% rose: xc:red null:
Furthermore, my result on a current version of IM gives different values than what you said.
So I think you need to upgrade your version of IM.
compare -metric rmse -subimage-search -dissimilarity-threshold 100% rose: xc:red null:
Furthermore, my result on a current version of IM gives different values than what you said.
So I think you need to upgrade your version of IM.
Re: [HELP] Autocrop batch on photo ID
Should i upgrade my imgaemgaick to version 6.7.8?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: [HELP] Autocrop batch on photo ID
newbie1 wrote:Should i upgrade my imgaemgaick to version 6.7.8?
I just checked and my 6.6.9.7 was not installed. So I cannot say for sure that your version of IM is bad.
The only indication I have is that my result from
compare -metric rmse -subimage-search -dissimilarity-threshold 100% rose: xc:red null:
143.673 (0.00219231) @ 32,20
is not the same as yours. If you get a return value that is the same, then your unix may be missing the sed command and that could be why it is not returning anything.
This works for me and returns:
value=`compare -metric rmse -subimage-search rose: xc:red null: 2>&1 | sed -n 's/^.*(\(.*\)).*$/\1/p'`
echo "$value"
0.00219231
Double check both again and let me know what you get.
If you type
man sed
does that give you the man pages for sed? Or does it say there is no sed command?
Re: [HELP] Autocrop batch on photo ID
It get me to the man pages for sed.
I think it really is my version of imagemagick. So, i will now update to version 6.7.8
I think it really is my version of imagemagick. So, i will now update to version 6.7.8
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: [HELP] Autocrop batch on photo ID
newbie1 wrote:It get me to the man pages for sed.
I think it really is my version of imagemagick. So, i will now update to version 6.7.8
Get the latest version 6.7.8.9.
Re: [HELP] Autocrop batch on photo ID
The latest is 6.7.8.10 should i install that?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: [HELP] Autocrop batch on photo ID
Sure, that should be fine.newbie1 wrote:The latest is 6.7.8.10 should i install that?
Re: [HELP] Autocrop batch on photo ID
I don't think i can install the lastest version as my ubuntu synaptic latest version is 6.6.9-7
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: [HELP] Autocrop batch on photo ID
I just installed IM 6.7.8.10 and I get this:
compare -metric rmse -subimage-search rose: xc:red null:
143.673 (0.00219231) @ 32,20
compare -metric rmse -subimage-search rose: xc:red null: 2>&1 | sed -n 's/^.*(\(.*\)).*$/\1/p'
0.00219231
If that does not work, try
compare -metric rmse -subimage-search rose: xc:red null: 2>&1 | tr -cs ".0-9\n" " " | cut -d\ -f 2
0.00219231
compare -metric rmse -subimage-search rose: xc:red null:
143.673 (0.00219231) @ 32,20
compare -metric rmse -subimage-search rose: xc:red null: 2>&1 | sed -n 's/^.*(\(.*\)).*$/\1/p'
0.00219231
If that does not work, try
compare -metric rmse -subimage-search rose: xc:red null: 2>&1 | tr -cs ".0-9\n" " " | cut -d\ -f 2
0.00219231
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: [HELP] Autocrop batch on photo ID
I do not know what to tell you. trynewbie1 wrote:I don't think i can install the lastest version as my ubuntu synaptic latest version is 6.6.9-7
compare -metric rmse -subimage-search -dissimilarity-threshold 100% rose: xc:red null:
143.673 0.00219231 32 20
compare -metric rmse -subimage-search -dissimilarity-threshold 100% rose: xc:red null: 2>&1 | tr -cs ".0-9\n" " " | cut -d\ -f 2
0.00219231
If that does not work, can you back down to earlier releases of IM?
Re: [HELP] Autocrop batch on photo ID
Finally it works!
I updates my imagemagick to the latest version.
The script is:
But there a problem. Its very very slow. When i start the script, it takes about 35 seconds for it to finish.
Is there any way to reduce the time taken ?
I updates my imagemagick to the latest version.
The script is:
Code: Select all
#!/bin/sh
value=`compare -metric rmse -subimage-search 2.jpg 1.jpg null: 2>&1 | sed -n 's/^.*(\(.*\)).*$/\1/p'`
test=`convert xc: -format "%[fx:$value<0.022?1:0]" info:`
if [ $test -eq 1 ]; then
convert 4.jpg oldid.jpg
else
convert 4.jpg newid.jpg
fi
Is there any way to reduce the time taken ?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: [HELP] Autocrop batch on photo ID
You can try to use my script, norcrosscorr, but that requires IM in Q16 HDRI mode. It uses FFT to do fast correlation. See also http://www.fmwconcepts.com/imagemagick/ ... mcrosscorrnewbie1 wrote:Finally it works!
I updates my imagemagick to the latest version.
The script is:But there a problem. Its very very slow. When i start the script, it takes about 35 seconds for it to finish.Code: Select all
#!/bin/sh value=`compare -metric rmse -subimage-search 2.jpg 1.jpg null: 2>&1 | sed -n 's/^.*(\(.*\)).*$/\1/p'` test=`convert xc: -format "%[fx:$value<0.022?1:0]" info:` if [ $test -eq 1 ]; then convert 4.jpg oldid.jpg else convert 4.jpg newid.jpg fi
Is there any way to reduce the time taken ?
You might get a bit speed up by using a simpler error measure than rmse. see http://www.imagemagick.org/Usage/compare/#statistics
Re: [HELP] Autocrop batch on photo ID
After testing out different error measure, i realised that the script take too long to finish is because of "-subimage-search".
So, i took out "-subimage-search", but after tooking it out, there an error that say the width and height of the small and large image is different.
Then, I use the OldID and crop out everything except the word "STUDENT".(student1.jpg)
After testing it out, The RMSE difference is too little.
But i found 2 error measure that has quite a difference.
The first one is NCC.
The error between the student1.jpg and oldID.jpg is
The error between the student1.jpg and newID.jpg is
However, after putting it into the script, there is an error. It is able to run but the output is wrong.
The second one is AE -fuzz 10%
The error between the student1.jpg and oldID.jpg is
The error between the student1.jpg and newID.jpg is
The same error occur when i run this script. It is able to run but the output is wrong.
What is wrong in the script?
So, i took out "-subimage-search", but after tooking it out, there an error that say the width and height of the small and large image is different.
Then, I use the OldID and crop out everything except the word "STUDENT".(student1.jpg)
After testing it out, The RMSE difference is too little.
But i found 2 error measure that has quite a difference.
The first one is NCC.
The error between the student1.jpg and oldID.jpg is
Code: Select all
0.0842306
Code: Select all
0.0514787
Code: Select all
#!/bin/sh
value=`compare -metric NCC newID.jpg student1.jpg null: 2>&1 | sed -n 's/^.*(\(.*\)).*$/\1/p'`
test=`convert xc: -format "%[fx:$value<0.065?1:0]" info:`
if [ $test -eq 1 ]; then
convert 4.jpg newid.jpg
else
convert 4.jpg oldid.jpg
fi
The second one is AE -fuzz 10%
The error between the student1.jpg and oldID.jpg is
Code: Select all
372197
Code: Select all
467993
Code: Select all
#!/bin/sh
value=`compare -metric NCC newID.jpeg student1.jpg null: 2>&1 | sed -n 's/^.*(\(.*\)).*$/\1/p'`
test=`convert xc: -format "%[fx:$value<420000?1:0]" info:`
if [ $test -eq 1 ]; then
convert 4.jpg oldid.jpg
else
convert 4.jpg newid.jpg
fi
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: [HELP] Autocrop batch on photo ID
What is the error message when running the script?
I suspect the sed command is likely not doing the right thing, because the output from compare is now different.
compare -metric rmse rose: \( -size 70x46 xc:red \) null:
28533 (0.435386)
But
compare -metric NCC rose: \( -size 70x46 xc:red \) null:
0
This does not look right. I would expect some difference. But only one value in the range 0 to 1. I suspect one gets zero here because there is not one single pixel in the rose image that is exactly red.
This gives a perfect match thought there is some precision issue that cause the result to be slightly larger than 1.
compare -metric NCC rose: rose: null:
1.00031
Likewise
compare -metric AE -fuzz 10% rose: \( -size 70x46 xc:red \) null:
3220
This is only giving the raw counts. This is probably correct with only one value. It is not normalized and so is going to be image size dependent, unless you divide by the total pixels in the image.
You have to understand that different error measure produce different output. So sed is not finding any parenthesis to locate the value in the parenthesis.
For these measures, just take out the sed command.
value=`compare -metric AE -fuzz 10% image1 image2 null: 2>&1`
I suspect the sed command is likely not doing the right thing, because the output from compare is now different.
compare -metric rmse rose: \( -size 70x46 xc:red \) null:
28533 (0.435386)
But
compare -metric NCC rose: \( -size 70x46 xc:red \) null:
0
This does not look right. I would expect some difference. But only one value in the range 0 to 1. I suspect one gets zero here because there is not one single pixel in the rose image that is exactly red.
This gives a perfect match thought there is some precision issue that cause the result to be slightly larger than 1.
compare -metric NCC rose: rose: null:
1.00031
Likewise
compare -metric AE -fuzz 10% rose: \( -size 70x46 xc:red \) null:
3220
This is only giving the raw counts. This is probably correct with only one value. It is not normalized and so is going to be image size dependent, unless you divide by the total pixels in the image.
You have to understand that different error measure produce different output. So sed is not finding any parenthesis to locate the value in the parenthesis.
For these measures, just take out the sed command.
value=`compare -metric AE -fuzz 10% image1 image2 null: 2>&1`
Last edited by fmw42 on 2012-08-13T19:39:56-07:00, edited 2 times in total.
Re: [HELP] Autocrop batch on photo ID
Ther is error mesage is:
But there is still a output and the output is awalys newid.jpg which is in the else statement.
Code: Select all
convert: missing expression `' @ error/fx.c/FxEvaluateSubexpression/2111.
/home/user/123/test1.sh: 4: [: -eq: unexpected operator