apply curv to image

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: apply curv to image

Post by fmw42 »

I do not understand what you want and what is wrong in the black box. If you think it is too "flat" and not enough wrinkles, you would need either to try to increase the contrast or use a different white sleeve image, since the one you have is totally white in that area. You also should increase the displacement arguments and do it in both dimensions.

try

Code: Select all

convert mask.png -gamma 0.7 -evaluate subtract 20% -sigmoidal-contrast 8x50% mask2.png
If something like this does not work, then you will need to get a new sleeve image or modify it to show more wrinkles in that region.

If you want to make the stripes narrower, you either need to make a stripe pattern with narrower stripes or you need to repeat the process of duplicate append scale a second time:

replace:

Code: Select all

( red.png +duplicate -append +duplicate +append -scale 50% )
with:

Code: Select all

( red.png +duplicate -append +duplicate +append -scale 50% +duplicate -append +duplicate +append -scale 50% )
You also need to brighten the stripe pattern

try this, though it is not much better

Code: Select all

convert \( mask.png -gamma 0.7 -evaluate subtract 20% -sigmoidal-contrast 8x50% \) \
\( red.png +duplicate -append +duplicate +append -resize 50% \
+duplicate -append +duplicate +append -resize 50% -evaluate add 30% \) \
\( -clone 0 \) \
\( -clone 1 -clone 0 -virtual-pixel transparent -compose displace \
-set option:compose:args -25x-25 -composite \) \
-delete 0,1 -compose multiply -composite new.png
Image
vinod
Posts: 20
Joined: 2016-03-10T13:50:05-07:00
Authentication code: 1151

Re: apply curv to image

Post by vinod »

thanks for replay sir. . but in above result i need to do more better ... i will try it sir no problem..,

sleeve Image

pattern Image

i have apply this pattern on sleeve & this is my result

hand 2 Image

and i want such as

hand 1 Image

in hand 1 at solder it is quite curvy and my result lines look straight.. i want to curv it. . like in result hand 1

i am using this script

convert sleeve.png -level 70%,100% -background none -flatten ( pattern.png +duplicate -append +duplicate +append -scale 60% ) ( -clone 0 ) ( -clone 1 -clone 0 -virtual-pixel transparent -compose displace -set option:compose:args -5x1 -composite ) -delete 0,1 -compose multiply -composite hand2.png

how can i give curv to it at near solder ? it like in hand 1

please replay. :(
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: apply curv to image

Post by fmw42 »

Your sleeve does not show any wrinkles at the shoulder, so there will be no curves in your results. You cannot get curves if the sleeve has no wrinkles. Just not possible if the sleeve is totally white and no shading where you want curves.
vinod
Posts: 20
Joined: 2016-03-10T13:50:05-07:00
Authentication code: 1151

Re: apply curv to image

Post by vinod »

" You cannot get curves if the sleeve has no wrinkles"
- sir i already apply displace -set option:compose:args -5x1 to all pattern so it automatically takes wrinkles i do not apply it in particular area as u can see this sir. what can i do more than that there ?
"Just not possible if the sleeve is totally white and no shading where you want curves."
- so what i need to do in that case ? because i want curves at solders as per in hand 1 image.
please help
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: apply curv to image

Post by fmw42 »

First you should be using -5x-5, not -5x1. Try increasing -5 to -15 or -25. If that does not help, then you need to manually paint wrinkles onto the white sleeve where you want to add curves.
vinod
Posts: 20
Joined: 2016-03-10T13:50:05-07:00
Authentication code: 1151

Re: apply curv to image

Post by vinod »

sir you mean to say if i drop some shading near solder then it ill automatically takes curve in -20 or - 30 degree angel ?

sir , -5x-5 also do not makes more sense and if we do it -25 then it looks very ugly. . and yes sir i have to add shading using photoshop right. . .
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: apply curv to image

Post by fmw42 »

Yes, you would need to use something like Photoshop to paint shading to get curves where the shading is placed. The displacement map technique curves the texture only where there is a shading change. Get someone with artistic skills to do the painting to add wrinkles to the sleeve.
vinod
Posts: 20
Joined: 2016-03-10T13:50:05-07:00
Authentication code: 1151

Re: apply curv to image

Post by vinod »

i will do it and i will post the replay sir...
vinod
Posts: 20
Joined: 2016-03-10T13:50:05-07:00
Authentication code: 1151

Re: apply curv to image

Post by vinod »

hello sir

convert 2.png 3.png 4.png -background none -flatten -level 50%,100% ( brown_checks.jpg +duplicate -append +duplicate +append -scale 50% ) ( -clone 0 ) ( -clone 1 -clone 0 -virtual-pixel transparent -compose displace -set option:compose:args -15x-15 -composite ) -delete 0,1 -compose multiply -composite result.png

this works fine and i got o/p as no white line are there.. as we combine mask files...

result.png

Image


but i need to apply different pattern images seperately sometime. so if i do following operation like

convert 2.png -background none -flatten -level 50%,100% ( brown_checks.jpg +duplicate -append +duplicate +append -scale 50% ) ( -clone 0 ) ( -clone 1 -clone 0 -virtual-pixel transparent -compose displace -set option:compose:args -15x-15 -composite ) -delete 0,1 -compose multiply -composite result_2.png

convert 3.png -background none -flatten -level 50%,100% ( brown_checks.jpg +duplicate -append +duplicate +append -scale 50% ) ( -clone 0 ) ( -clone 1 -clone 0 -virtual-pixel transparent -compose displace -set option:compose:args -15x-15 -composite ) -delete 0,1 -compose multiply -composite result_3.png

convert 4.png -background none -flatten -level 50%,100% ( brown_checks.jpg +duplicate -append +duplicate +append -scale 50% ) ( -clone 0 ) ( -clone 1 -clone 0 -virtual-pixel transparent -compose displace -set option:compose:args -15x-15 -composite ) -delete 0,1 -compose multiply -composite result_4.png

and then combine them with

convert result_2.png result_3.png -compose over -composite rst1.png

convert rst1.png result_4.png -compose over -composite rst2.png

rst2.png

Image

see the white lines..where mask files are combile. ..

problem section Image

what chnages i need to do in above command so white line will not be appear ?

you told me last time that there is -auto-level so it give you white line as you can see above there is no issue of auto level so where could be problem sir in command ? please help ..
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: apply curv to image

Post by fmw42 »

see my earlier post at viewtopic.php?f=1&t=29498#p132320
vinod
Posts: 20
Joined: 2016-03-10T13:50:05-07:00
Authentication code: 1151

Re: apply curv to image

Post by vinod »

sir. . . i have seen post

i can scale the pattern first by

convert pattern_file.jpg ( +clone -flip ) -append ( +clone -flop ) +append -scale 50% scal_pattern.jpg

then

i can use

convert image.png ( -clone 0 -level 50%,100% -alpha off scal_pattern.jpg -virtual-pixel transparent -compose multiply -composite ) -compose SrcIn -composite result.png

this give me correct result without white lines even it is present in i/p image etc. .

but this thing i cant add in this that is " displace -set option:compose:args -15x-15 ".

problem is here. . so either i want to correct

a) convert 2.png -background none -flatten -level 50%,100% ( brown_checks.jpg +duplicate -append +duplicate +append -scale 50% ) ( -clone 0 ) ( -clone 1 -clone 0 -virtual-pixel transparent -compose displace -set option:compose:args -15x-15 -composite ) -delete 0,1 -compose multiply -composite result_2.png

or

i want to add "displace -set option:compose:args -15x-15 " in

b) convert image.png ( -clone 0 -level 50%,100% -alpha off scal_pattern.jpg -virtual-pixel transparent -compose multiply -composite ) -compose SrcIn -composite result.png

sir how can i add "displace -set option:compose:args -6x-1 " in b) command ? above ?
means i just want to add "displace -set option:compose:args -15x-15 " in "convert image.png ( -clone 0 -level 50%,100% -alpha off scal_pattern.jpg -virtual-pixel transparent -compose multiply -composite ) -compose SrcIn -composite result.png"

i try a lot did not succeeded...

replay plz :(
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: apply curv to image

Post by fmw42 »

Sorry I do not understand. The lines come from the white shirt. Why can you not just use the first method that does not show the lines?
Why can you not just combine the white parts of the shirt first and then process so you do not get lines?
vinod
Posts: 20
Joined: 2016-03-10T13:50:05-07:00
Authentication code: 1151

Re: apply curv to image

Post by vinod »

means how sir ? i do not understand exactly what are you saying ? can u show it by command plz ?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: apply curv to image

Post by fmw42 »

If you do not combine the parts of the white shirt, there are edge effects due to antialising. These edges will show differently if you process your parts separately and thus show lines. However, if you put the parts together so that the edges are merged, then there are no edge effects and you should not get any lines, unless the there are differences in brightness from the different parts of the shirt.
vinod
Posts: 20
Joined: 2016-03-10T13:50:05-07:00
Authentication code: 1151

Re: apply curv to image

Post by vinod »

yes this is due to antialising if i used


convert 2.png -background none -flatten -brightness-contrast -20,20 \
\( brown_checks.jpg +duplicate -append +duplicate +append -scale 50% \) \
\( -clone 0 \) \
\( -clone 1 -clone 0 -virtual-pixel transparent -compose displace -set option:compose:args 15x15 -composite \) \
-delete 0,1 -compose multiply -composite resul2.png


convert 3.png -background none -flatten -brightness-contrast -20,20 \
\( brown_checks.jpg +duplicate -append +duplicate +append -scale 50% \) \
\( -clone 0 \) \
\( -clone 1 -clone 0 -virtual-pixel transparent -compose displace -set option:compose:args 15x15 -composite \) \
-delete 0,1 -compose multiply -composite resul3.png
.
.
.
etc separately and then combine them . .


and antialising does not appear if i used

convert 2.png ( -clone 0 -level 50%,100% -alpha off scal_pattern.jpg -virtual-pixel transparent -compose multiply -composite ) -compose SrcIn -composite result2.png


convert 3.png ( -clone 0 -level 50%,100% -alpha off scal_pattern.jpg -virtual-pixel transparent -compose multiply -composite ) -compose SrcIn -composite result3.png
.
.
.
etc. . and combine them




means you mean to say that i should use

convert 2.png 3.png 4.png -background none -flatten -brightness-contrast -20,20 \
\( brown_checks.jpg +duplicate -append +duplicate +append -scale 50% \) \
\( -clone 0 \) \
\( -clone 1 -clone 0 -virtual-pixel transparent -compose displace -set option:compose:args 15x15 -composite \) \
-delete 0,1 -compose multiply -composite result234b.png

this ? that you have given ?
Post Reply