| Notices | Welcome to RetouchPRO . You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload images and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. | | Software Photoshop, Paintshop Pro, Painter, etc., and all their various plugins. Of course, you can also discuss all other programs, as well. | 
04-17-2006, 01:45 PM
|  | Senior Member | | Join Date: Jan 2005
Posts: 314
| | | Good show.
CMYK = print
RGB = monitor
Lab = eyeballs
There is far more to this than just code. Percentage of what?
The answer is in the link you provided.
C = ( C' - K ) / ( 1 - K )
Or even ( 255 - K ).
And that should fix that.
Still one more logic bomb to find.
You are on a roll, Ken.
I have faith.
Consider: what happens when C' == K? | 
04-17-2006, 03:01 PM
|  | Senior Member | | Join Date: Feb 2005 Location: Lancashire (UK)
Posts: 1,112
| | If it is true that Cyan equals Black?
This would give zero from the formula which it not right.
But again maybe this bit of the formula is wrong. Should the black content not come from the RGB values?
I have been trying to make some sense of this list of converted colours http://en.wikipedia.org/wiki/List_of_colors
I hope you have some ideas because I can’t.
It seems we may be back to vectors.
Ken. | 
04-17-2006, 03:45 PM
|  | Senior Member | | Join Date: Jan 2005
Posts: 314
| | Instead of this Code: black=min(cyan,min(magenta,yellow));
try this instead Code: black=min(cyan,min(magenta,yellow)) * 0.85;
On my machine, 85% is pretty close. Not the greatest, but close enough for slop. What that extra *0.85 will do is make sure that no CMY in CMYK will be 0%.
On a related note, the current code does not allow for adding when C = 0%. That is, if C=0%, then C will remain at 0% no matter what. There is a way to fix this, but the *0.85 will take care of it.
The last thing to fix is the percentages of CMY in CMYK.
Instead of 0 to 255 as percent
Needs to be 0 to ( 255 - K ) as percent
For this, you will have to dig into either data types or order of operations. Well, I think order of operations will fix it. But I do know data types will.
Once you get that, your custom filter should be close enough. Quote: |
It seems we may be back to vectors.
| Vector can be a variety of things, so to speak. If you look at the mathematical definition(s) of vector, you should see how it can apply to a wide range of things - not just vector as we've used it. Well, not used the word vector, but how we used vectors themselves.
Sure is fun, isn't it? | 
04-18-2006, 02:03 PM
|  | Senior Member | | Join Date: Feb 2005 Location: Lancashire (UK)
Posts: 1,112
| | | Yes. It’s great fun.
It sound like you have not looked at CMYK in the past. So this may be something new for you as well.
I’ve added the 0.85 but I can’t see any improvement because I am still looking at a negative image. Have you added something else? Or do I still need 255-K
data types or order of operations
If I understand this right. Are we looking at some sort of lookup table (fscanf)?
Ken. | 
04-18-2006, 03:08 PM
|  | Senior Member | | Join Date: Jan 2005
Posts: 314
| | Kind of new but kind of not. I do understand CMYK, but I'm not really familiar with the nuances of working with CMYK.
Check this out. Back in post #250, this little bit is in the code: Quote:
// no need for this
//range=255-black;
| I put that in way back when because I knew there would eventually be a need for it. Kind of knew to me, but sometimes I am that smart. Heh. :toot toot:
Order of operations has to do with with order in which forumals are done. For example, there is a difference between X*Y/100 and X/100*Y. This is *especially* important if you are working with integers.
If you are seeing a negative image, then something is upside-down or inverted or something. I'll look at the last code you posted. If you are working newer code, post it. | 
04-18-2006, 03:29 PM
|  | Senior Member | | Join Date: Jan 2005
Posts: 314
| | I just took a look at your "RGB and CMYK Channel Mixer". I think you have a fundamental problem. That being that RGB is additive and CMYK is subtractive. They don't exactly go in the same direction as it were.
Consider
RGB(0,0,0) = pure black
CMYK(0,0,0,0) = pure white
If your starting point is black and everything is 0, then you can't exactly add more black. Right?
You will have to do some un-inverting. Or re-think your starting point and how you want to mix the channels. If you add more cyan, do you want it to brighten or darken?
Try this in your mixer: Code: // get k or black
black=min(cyan,min(magenta,yellow)) *0.85;
// subtract black
// range 0 to 255 ---> range 0 to 100
cyan=255-cyan-black;
magenta=255-magenta-black;
yellow=255-yellow-black;
// Scale values
out=(red*ctl(0)/100)+(green*ctl(1)/100)+(blue*ctl(2)/100);
out=out+(cyan*ctl(3)/100)+(magenta*ctl(4)/100)+(yellow*ctl(5)/100);
out=out-(black*ctl(6)/100);
Last edited by Stroker; 04-18-2006 at 03:35 PM.
| 
04-19-2006, 02:31 PM
|  | Senior Member | | Join Date: Feb 2005 Location: Lancashire (UK)
Posts: 1,112
| | Hi Stroker.
I added your code in (and a bit of my own)
My idea originally was that I could build a channel mixer where I could mix Red and Cyan. Or extract the Yellow channel for example.
I have added ‘inverts’ to the channels so that I can do both the above.
My current code is attached.
All suggestions/Corrections/Improvements are welcome.
In the Invert CMY Section. I feel like I’m extracting black twice but your code seems to work better than
if (ctl(9)==1) (yellow=255-yellow);
Which is what I would have written
Ken. Code: %ffp
Title :"RGB and CMYK Channel Mixer"
ctl(0):standard,"Red",range=(0,100),val=30,track
ctl(1):standard,"Green",range=(0,100),val=59,track
ctl(2):standard,"Blue",range=(0,100),val=11,track
ctl(3):standard,"Cyan",range=(0,100),val=0,track
ctl(4):standard,"Magenta",range=(0,100),val=0,track
ctl(5):standard,"Yellow",range=(0,100),val=0,track
ctl(6):standard,"Black",range=(0,100),val=0,track
ctl[7]: CHECKBOX, "Invert Cyan",pos=(380,90)
ctl[8]: CHECKBOX, "Invert Magenta",pos=(380,100)
ctl[9]: CHECKBOX, "Invert Yellow",pos=(380,110)
ctl[10]: CHECKBOX, "Invert Black",pos=(380,120)
supportedmodes: rgbmode
ForEveryTile:{
int x,y,red,green,blue,range;
int black,cyan,magenta,yellow;
int out;
for (y=y_start; y<y_end; y++){
if(updateProgress(y,y_end)) abort();
for (x=x_start; x<x_end; x++){
// grab values
red=src(x,y,0);
green=src(x,y,1);
blue=src(x,y,2);
cyan=255-src(x,y,0);
magenta=255-src(x,y,1);
yellow=255-src(x,y,2);
// get k or black
//black=min(cyan,min(magenta,yellow));
black=min(cyan,min(magenta,yellow)) * 0.85;
// subtract black
// range 0 to 255 ---> range 0 to 100
cyan=(cyan-black)/2.55;
magenta=(magenta-black)/2.55;
yellow=(yellow-black)/2.55;
// Invert CMY
if (ctl(7)==1) (cyan=255-cyan-black);
if (ctl(8)==1) (magenta=255-magenta-black);
if (ctl(9)==1) (yellow=255-yellow-black);
if (ctl(10)==1) (black=255-black);
// Scale values
out=(red*ctl(0)/100)+(green*ctl(1)/100)+(blue*ctl(2)/100);
out=out+(cyan*ctl(3)/100)+(magenta*ctl(4)/100)+(yellow*ctl(5)/100);
out=out+(black*ctl(6)/100);
// output
pset(x,y,0,out);
pset(x,y,1,out);
pset(x,y,2,out);
}}// x, y
return true;
} // for every tile
| 
04-20-2006, 03:00 PM
|  | Senior Member | | Join Date: Jan 2005
Posts: 314
| | | No more suggests at this time, Mr. Ken. If it's working the way you want, then you should be golden. If you keep messing with FM, maybe some day come back to your mixer and do more things with it in your own way.
You should see the code to some of my first filters. Now that I know more, looking at my old code is almost painful.
One major things has been condensing several smaller filters into one. I used to have one filter for extracting hue, another for extracting sat, and yet another for extracting lum. I eventually put it all together into one.
Another major thing for me has been balance. Do I want a major uber filter for making a variety of greyscale masks? Then use the mask for tweaks once I get back to Photoshop? Or do I want specific greyscale mask with specific tweaks all in one filter? | 
04-21-2006, 02:24 PM
|  | Senior Member | | Join Date: Feb 2005 Location: Lancashire (UK)
Posts: 1,112
| | I’ve still got the separate hue sat and lum filters installed and I still use them. I did install the three-in-one but I still has to be run three times so there is not that much difference. It’s a shame that FM won’t create new layers.
The channel mixer is never going to be perfect unless we could get Adobes conversion. The one we used is not the same. However it is working of a fashion.
There is some cmy2rgb code here http://groups.yahoo.com/group/FMML/message/3220
I may try again with this.
I’ve still got loads of ideas I want to code. Several of them are using Deconvolution
I know I can use the convolution filter (As in post 49) But I think I need to do a lot more reading on deconvolution.
I found the code for one of my ideas here http://groups.yahoo.com/group/FMML/message/2136
I have implemented the changes suggested here http://groups.yahoo.com/group/FMML/message/2138
I have not got this working properly but PshopLifter has now finished this and is available here http://home.planet.nl/~ber03728/4N6site/main.htm
There is some interesting stuff there. Roll your mouse over the picture at the bottom of the page. And read the ‘Explaining Colour Deconvolution’ I think you will find it interesting. His link to http://www.couleur.org/ is interesting too.
I have requested His filters.
Ken | 
04-29-2006, 12:03 PM
|  | Senior Member | | Join Date: Jan 2005
Posts: 314
| | Yeah, I've been slacking lately all around. So much junk to do.
- more High Pass tutorials
- extracting difference tutorials
- variable frequency tutorials (variable medium frequencies rock)
- several filters to polish as a direct result of this thread
- I figured out how Photoshop handles hue and sat in Lab mode so Lab filters can be made PS friendly
- playing with several ideas for flesh tweaking
- new water softner to install
- dishes and laundry to do
It is possible to RGB > CMYK the way Photoshop does it. You will have to get into ICC and junk to do it. Color dot Org? I'm not entirely sure, but I do know it's not a journey I don't want to take. | 
05-02-2006, 11:47 AM
|  | Senior Member | | Join Date: Feb 2005 Location: Lancashire (UK)
Posts: 1,112
| | The more I read on CMYK the more I realised it was dependant on ICC profiles. And I don’t want to get into that stuff either.
I read the new tutorials. I see you put the Silly Difference Trick in there. I was amazed when I first saw that used at PST and I downloaded the instructions from the Asylum.
There has been a lot of discussion recently regarding saturation changes with blending modes (dodge and burn) I have found that a Select All > Copy Merged > Paste
Then set blending mode to Luminosity seems to work OK. (Turning off the adjustment layers)
Thanks for the new Tutorials Stroker.
Next Project.
My next project is to try to simulate the Healing Tool.
I would like to get the results of the healing tool without having to stamp my way all over the picture.
I have scoured the web for a formula but have had no success.
This is what I usually do.
Create a 50% grey layer and add noise matching the photo. I then use this as my source to heal onto the picture. It would be nice to do this with FM because it is quite time consuming. It would also need a radius (Or brush size) slider.
It seems to involve a layer of noise (matching the source) but taking the luminosity of the original somehow.
I have found the Perlin noise command implemented by Ron Chambers http://groups.yahoo.com/group/FMML/message/707 Quote:
perlinNoise1D()
perlinNoise2D()
perlinNoise3D()
produces one/two/three-dimensional perlin noise. There will be parameters
for persistance, octaves and random seed.
|
This feature should be implemented but there is nothing in the Wiki (As usual) and I’m not sure what to put into the brackets. But I get a Symbol ‘perlin’ Undefined error. So maybe this was never implemented.
There is noise code here http://freespace.virgin.net/hugo.eli...s/m_perlin.htm Quote:
function IntNoise(32-bit integer: x)
x = (x<<13) ^ x;
return ( 1.0 - ( (x * (x * x * 15731 + 789221) + 1376312589) & 7fffffff) / 1073741824.0);
end IntNoise function
|
So it looks quite easy to make my own. But I am not sure how the healing tool uses this.
Ken. | 
05-03-2006, 04:22 PM
|  | Senior Member | | Join Date: Jan 2005
Posts: 314
| | | Perlin Noise is fun. You can already do it with Photoshop's stock tools, or even FM.
There are two main things that define Perlin Noise: pseudo-random and interpolation. Now, pseudo-random really matters when you are into animating the texture. For the vast majority of 2d work, don't really need pseudo-random. The interpolation for PNoise is bi-cubic, sometimes smoother and sometimes not.
Armed with that and some sub-pixel savvy, we can hack PNoise in Photoshop.
- New document and fill with 50% grey.
- Filter > Noise > Add Noise to taste.
- Rectangular Marque and select a small square.
- Copy and paste small square to new layer.
- Preferences and make sure interpolation is set to Bi-Cubic Smoother
- On the small rectangle layer, Edit > Transform > Free Transform and make it huge.
Once you commit the Free Transform, watch the magic as Bi-Cubic Smoother kicks in. Tada. Instant Perlin Noise.
To do this with FM, use iget(). Fill one of the buffers with random noise, then use iget() to sample sub-pixels. I might have a working sample in my FM archives somewhere.
BBL | 
05-03-2006, 05:22 PM
|  | Senior Member | | Join Date: Jan 2005
Posts: 314
| | Okay, here is my first attempt at PNoise using iget(). Code: %ffp
ctl(0): "Size",Range=(2,64),Val=32
ctl(1): "Seed",Range=(1,100),Val=50
ctl(10): combobox(vscroll),action=preview, color=#FFFFFF,fontcolor=#0000ff,
pos=(325,40),size=(70,200),
text="Nearest Neighbor\nBisquare\nBicosine\nBilinear\nBicubic",val=4
ctl(100):STATICTEXT, pos=(325,70),"", fontcolor=black
ForEveryTile:
{
int x,y,beginsizex,beginsizey;
int finalvalue;
float p1,q1;
beginsizex=(X*1/ctl(0));
beginsizey=(Y*1/ctl(0));
rst(ctl(1));
for (y=0; y<beginsizey+1; y++){
for (x=0; x<beginsizex+1; x++){
tset(x,y,0,rnd(0,255));
}//x base
}//y base
for (y=0;y<Y;y++){
for (x=0;x<X;x++){
p1=(float)x*beginsizex/X;
q1=(float)y*beginsizey/Y;
finalvalue=iget(p1,q1,0,1,ctl(10));
pset(x,y,0,finalvalue);
pset(x,y,1,finalvalue);
pset(x,y,2,finalvalue);
}//end x
}//end y
return true;
}
While it illustrates the idea, it is fraught with bombs. The first bomb being the 2d range. That is, uses 0 to X instead of x_start to x_end. For larger images there will be a speed difference. A real bomb is how the division is handled. The division in the code is *very* half-baked. The division also needs to take scaleFactor into account.
Man, and that's not even getting into fractal or turbulent noise. When will it end?
I adore the Silly Difference Trick. While it is mostly a bauble, the derived techniques are very cool. Maybe tonight I'll toss another one or two up after I get some dishes done.
I'm not exactly sure what the Dodge & Burn thing is, but I have my suspicions. If it's what I think I think it is, maybe I'll toss some of my notes out for ya'll. It's basically selectively lightening and darkening by painting, right? |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | |