RetouchPRO

Go Back   RetouchPRO > Tools > Software
Register Blogs FAQ Site Nav Search Today's Posts Mark Forums Read


Software Photoshop, Lightroom, Paintshop Pro, Painter, etc., and all their various plugins. Of course, you can also discuss all other programs, as well.

FilterMeister - Gray Map Filter

Reply
 
Thread Tools
  #11  
Old 04-03-2006, 01:43 PM
Craig Walters's Avatar
Craig Walters Craig Walters is offline
Senior Member
 
Join Date: Apr 2005
Location: somewhere over there
Posts: 8,786
Blog Entries: 4
ok, this version works:
Code:
%ffp

OnFilterstart:{
setDialogPos( true, 50, 50, 550, 200 ); // repositions and resizes dialog window
setDialogColor (RGB(225,56,56));
//setDialogPos( false, -1, -1, 320, 240 ); // centers dialog according to host client area
return true;
}

//OnFilterstart:{
//	setCtlPos(CTL_OK,       420,280, -1, -1);
//	setCtlPos(CTL_CANCEL,   460,280, -1, -1);
//	setCtlPos(CTL_PREVIEW,    5,  5,175,150);
//	setCtlPos(CTL_ZOOM,     200,285, 50, 10);
//	setCtlPos(CTL_PROGRESS,   5,285,185, 10);
//	return false;
// }

ctl(0):"0",size=(*,6),pos=(265,8),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(1):"8",size=(*,6),pos=(265,16),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(2):"16",size=(*,6),pos=(265,24),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(3):"24",size=(*,6),pos=(265,32),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(4):"32",size=(*,6),pos=(265,40),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(5):"40",size=(*,6),pos=(265,48),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(6):"48",size=(*,6),pos=(265,56),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(7):"56",size=(*,6),pos=(265,64),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(8):"64",size=(*,6),pos=(265,72),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(9):"72",size=(*,6),pos=(265,80),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(10):"80",size=(*,6),pos=(265,88),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(11):"88",size=(*,6),pos=(265,96),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(12):"96",size=(*,6),pos=(265,104),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(13):"104",size=(*,6),pos=(265,112),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(14):"112",size=(*,6),pos=(265,120),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(15):"120",size=(*,6),pos=(265,128),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(16):"128",size=(*,6),pos=(410,8),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(17):"136",size=(*,6),pos=(410,16),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(18):"144",size=(*,6),pos=(410,24),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(19):"152",size=(*,6),pos=(410,32),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(20):"160",size=(*,6),pos=(410,40),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(21):"168",size=(*,6),pos=(410,48),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(22):"176",size=(*,6),pos=(410,56),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(23):"184",size=(*,6),pos=(410,64),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(24):"192",size=(*,6),pos=(410,72),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(25):"200",size=(*,6),pos=(410,80),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(26):"208",size=(*,6),pos=(410,88),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(27):"216",size=(*,6),pos=(410,96),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(28):"224",size=(*,6),pos=(410,104),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(29):"232",size=(*,6),pos=(410,112),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(30):"240",size=(*,6),pos=(410,120),range=(-1000,1000),val=0,color=gray,fontcolor=white,track
ctl(31):"248",size=(*,6),pos=(410,128),range=(-1000,1000),val=0,color=gray,fontcolor=white,track

ctl(72): PUSHBUTTON, "Reset all to 0",size=(47,14),pos=(484,160),val=0

ForEveryTile:{
int x,y,r,g,b,avg,final,number;
float workingfloat,weight1,weight2;


for (y=y_start; y<y_end; y++){
//if(updateProgress(y,y_end)) abort();
for (x=x_start; x<x_end; x++){

r=src(x,y,0);
g=src(x,y,1);
b=src(x,y,2);

avg=(r+g+b)/3;
//avg=r*0.30 + g*0.59 + b*0.11;

workingfloat=(float)avg/8.50;
// +0.5 for rounding
number=floor(workingfloat+0.5);

// again, +0.5 for rounding
weight1=(workingfloat+0.5)-number;
weight2=1.0 - weight1;

// checking along the way
//final=number*51;
//final=weight1*255;
//final=weight2*255;

// final weighted value
final=avg + ctl(number)*weight2 + ctl(number+1)*weight1;

// write the values back
pset(x,y,0,final);
pset(x,y,1,final);
pset(x,y,2,final);

{
  if  (ctl(72)) {
setCtlVal(0, 0),setCtlVal(1, 0),setCtlVal(2, 0),
setCtlVal(3, 0),setCtlVal(4, 0),setCtlVal(5, 0),setCtlVal(6, 0),
setCtlVal(7, 0),setCtlVal(8, 0),setCtlVal(9, 0),setCtlVal(10, 0),
setCtlVal(11, 0),setCtlVal(12, 0),setCtlVal(13, 0),setCtlVal(14, 0),
setCtlVal(15, 0),setCtlVal(16, 0),setCtlVal(17, 0),setCtlVal(18, 0),
setCtlVal(19, 0),setCtlVal(20, 0),setCtlVal(21, 0),setCtlVal(22, 0),
setCtlVal(23, 0),setCtlVal(24, 0),setCtlVal(25, 0),setCtlVal(26, 0),
setCtlVal(27, 0),setCtlVal(28, 0),setCtlVal(29, 0),setCtlVal(30, 0),
setCtlVal(31, 0); }

setCtlVal(72,0);

}

}} // x y

return true;
} // for every pixel
it's still pretty sloppy, but it now does work, all functions

craig
Reply With Quote top
  #12  
Old 04-03-2006, 02:16 PM
Cameraken's Avatar
Cameraken Cameraken is offline
Senior Member
 
Join Date: Feb 2005
Location: Lancashire (UK)
Posts: 1,158
Craig.

You just need to delete two lines

Rem out the bracket below - pset(x,y,2,final);
And Rem out - return false; }

Then it works OK.

Ken.
Reply With Quote top
  #13  
Old 04-03-2006, 03:45 PM
Craig Walters's Avatar
Craig Walters Craig Walters is offline
Senior Member
 
Join Date: Apr 2005
Location: somewhere over there
Posts: 8,786
Blog Entries: 4
thanks ken

ok, here's another version, a bit more enhanced. i also figured out those code bits Ro had supplied me and incorporated them as well. i also trimmed some of the percentile fat. instead of -1000,1000, i reduced these quite a bit on a scaling basis. there's just no need for -1000 when the pixel is already mostly black. i trimmed these all the way through. they could probably be reduced some more.

i also reduced the default 'page=10' to 'page=5'. all that does is make the sliders move less when you mousewheel them or click inside the scrollbar.

i increased the preview size by quite a bit and thus the overall size of the plugin. i got tired of scrolling around to see different parts of the preview. this still wont handle larger images fully, but it does make it easier to see things for me.

i also increased the size and spacing of the sliders for easier use and to fit proportionally with the new preview size.

i still havent studied 'for's and nesting and the 'if's very much, so the code is still pretty sloppy...longhand. but it does work

i've some more ideas for this thing, some shortcuts i can think of. i'm thinking of putting in sliders that handle more than one range at a time. maybe one with every other ctl value going up by 5 and the others going down by 5 each time you move this slider one increment. i could also see splitting the uppers and the lowers into one slider each. move one and the lowers all go up or down by 5; move the other and the uppers all go up or down by 5. or, you could have another that moves the 4 main levels, lows, low-mids, high-mids, and highs.

but basically, this current one is a done! so, thanks guys!

Code:
%ffp

OnFilterstart:{
setDialogPos( true, 5, 5, 580, 350 ); // repositions and resizes dialog window
setDialogColor (RGB(225,56,56));
//setDialogPos( false, -1, -1, 320, 240 ); // centers dialog according to host client area
setCtlPos(CTL_PREVIEW,    5,  5,400,315);
setCtlPos(CTL_ZOOM,     195,330, 50, 10);
setCtlPos(CTL_PROGRESS,   4,330,185, 10);
setCtlPos(CTL_OK,       425,330, -1, -1);
setCtlPos(CTL_CANCEL,   465,330, -1, -1);

return true;
}

ctl(0):"0",size=(*,8),pos=(436,5),range=(-100,500),val=0,color=gray,fontcolor=white,page=5,track
ctl(1):"8",size=(*,8),pos=(436,15),range=(-100,500),val=0,color=gray,fontcolor=white,page=5,track
ctl(2):"16",size=(*,8),pos=(436,25),range=(-100,500),val=0,color=gray,fontcolor=white,page=5,track
ctl(3):"24",size=(*,8),pos=(436,35),range=(-100,500),val=0,color=gray,fontcolor=white,page=5,track
ctl(4):"32",size=(*,8),pos=(436,45),range=(-100,500),val=0,color=gray,fontcolor=white,page=5,track
ctl(5):"40",size=(*,8),pos=(436,55),range=(-100,500),val=0,color=gray,fontcolor=white,page=5,track
ctl(6):"48",size=(*,8),pos=(436,65),range=(-100,500),val=0,color=gray,fontcolor=white,page=5,track
ctl(7):"56",size=(*,8),pos=(436,75),range=(-100,500),val=0,color=gray,fontcolor=white,page=5,track
ctl(8):"64",size=(*,8),pos=(436,85),range=(-200,500),val=0,color=gray,fontcolor=white,page=5,track
ctl(9):"72",size=(*,8),pos=(436,95),range=(-200,500),val=0,color=gray,fontcolor=white,page=5,track
ctl(10):"80",size=(*,8),pos=(436,105),range=(-200,500),val=0,color=gray,fontcolor=white,page=5,track
ctl(11):"88",size=(*,8),pos=(436,115),range=(-200,500),val=0,color=gray,fontcolor=white,page=5,track
ctl(12):"96",size=(*,8),pos=(436,125),range=(-200,500),val=0,color=gray,fontcolor=white,page=5,track
ctl(13):"104",size=(*,8),pos=(436,135),range=(-200,500),val=0,color=gray,fontcolor=white,page=5,track
ctl(14):"112",size=(*,8),pos=(436,145),range=(-200,500),val=0,color=gray,fontcolor=white,page=5,track
ctl(15):"120",size=(*,8),pos=(436,155),range=(-200,500),val=0,color=gray,fontcolor=white,page=5,track
ctl(16):"128",size=(*,8),pos=(436,165),range=(-500,200),val=0,color=gray,fontcolor=white,page=5,track
ctl(17):"136",size=(*,8),pos=(436,175),range=(-500,200),val=0,color=gray,fontcolor=white,page=5,track
ctl(18):"144",size=(*,8),pos=(436,185),range=(-500,200),val=0,color=gray,fontcolor=white,page=5,track
ctl(19):"152",size=(*,8),pos=(436,195),range=(-500,200),val=0,color=gray,fontcolor=white,page=5,track
ctl(20):"160",size=(*,8),pos=(436,205),range=(-500,200),val=0,color=gray,fontcolor=white,page=5,track
ctl(21):"168",size=(*,8),pos=(436,215),range=(-500,200),val=0,color=gray,fontcolor=white,page=5,track
ctl(22):"176",size=(*,8),pos=(436,225),range=(-500,200),val=0,color=gray,fontcolor=white,page=5,track
ctl(23):"184",size=(*,8),pos=(436,235),range=(-500,200),val=0,color=gray,fontcolor=white,page=5,track
ctl(24):"192",size=(*,8),pos=(436,245),range=(-500,100),val=0,color=gray,fontcolor=white,page=5,track
ctl(25):"200",size=(*,8),pos=(436,255),range=(-500,100),val=0,color=gray,fontcolor=white,page=5,track
ctl(26):"208",size=(*,8),pos=(436,265),range=(-500,100),val=0,color=gray,fontcolor=white,page=5,track
ctl(27):"216",size=(*,8),pos=(436,275),range=(-500,100),val=0,color=gray,fontcolor=white,page=5,track
ctl(28):"224",size=(*,8),pos=(436,285),range=(-500,100),val=0,color=gray,fontcolor=white,page=5,track
ctl(29):"232",size=(*,8),pos=(436,295),range=(-500,100),val=0,color=gray,fontcolor=white,page=5,track
ctl(30):"240",size=(*,8),pos=(436,305),range=(-500,100),val=0,color=gray,fontcolor=white,page=5,track
ctl(31):"248",size=(*,8),pos=(436,315),range=(-500,100),val=0,color=gray,fontcolor=white,page=5,track

ctl(72): PUSHBUTTON, "Reset all to 0",size=(47,14),pos=(505,330),val=0

ForEveryTile:{
int x,y,r,g,b,avg,final,number;
float workingfloat,weight1,weight2;


for (y=y_start; y<y_end; y++){
//if(updateProgress(y,y_end)) abort();
for (x=x_start; x<x_end; x++){

r=src(x,y,0);
g=src(x,y,1);
b=src(x,y,2);

avg=(r+g+b)/3;
//avg=r*0.30 + g*0.59 + b*0.11;

workingfloat=(float)avg/8.50;
// +0.5 for rounding
number=floor(workingfloat+0.5);

// again, +0.5 for rounding
weight1=(workingfloat+0.5)-number;
weight2=1.0 - weight1;

// checking along the way
//final=number*51;
//final=weight1*255;
//final=weight2*255;

// final weighted value
final=avg + ctl(number)*weight2 + ctl(number+1)*weight1;

// write the values back
pset(x,y,0,final);
pset(x,y,1,final);
pset(x,y,2,final);

{
  if  (ctl(72)) {
setCtlVal(0, 0),setCtlVal(1, 0),setCtlVal(2, 0),
setCtlVal(3, 0),setCtlVal(4, 0),setCtlVal(5, 0),setCtlVal(6, 0),
setCtlVal(7, 0),setCtlVal(8, 0),setCtlVal(9, 0),setCtlVal(10, 0),
setCtlVal(11, 0),setCtlVal(12, 0),setCtlVal(13, 0),setCtlVal(14, 0),
setCtlVal(15, 0),setCtlVal(16, 0),setCtlVal(17, 0),setCtlVal(18, 0),
setCtlVal(19, 0),setCtlVal(20, 0),setCtlVal(21, 0),setCtlVal(22, 0),
setCtlVal(23, 0),setCtlVal(24, 0),setCtlVal(25, 0),setCtlVal(26, 0),
setCtlVal(27, 0),setCtlVal(28, 0),setCtlVal(29, 0),setCtlVal(30, 0),
setCtlVal(31, 0); }

setCtlVal(72,0);

}

}} // x y

return true;
} // for every pixel
craig
Reply With Quote top
  #14  
Old 04-05-2006, 06:26 PM
Stroker's Avatar
Stroker Stroker is offline
Senior Member
 
Join Date: Jan 2005
Posts: 370
Okay, the weights thing for fading between controls and ranges.

It's not so much the controls and values that they represent, but the space inbetween.

First you get the base number that you are working with that is in the range 0 to 255 using whatever formula you like. Let's say this number is 17.

Then we get workingfloat by dividing. I'm going to stick to 51.

workingfloat = 17/51 = 0.33 repeating

Use the floor function to get just the integer portion.

number = floor( 0.33 )
number = 0

This integer will be used for control numbers.
ctl( number ) = ctl( 0 ) and
ctl( number + 1 ) = ctl( 1 )

Those are the controls that we are working between.

Now we need to get the mantissa. This is the decimal portion. This is the percentage needed to weight the influence of the controls.

weight1 = workingfloat - number
weight1 = 0.33 - 0
weight1 = 0.33

Invert in the range of 0 to 1 for weight2
weight2 = 1.00 - weight1
weight2 = 1.00 - 0.33
weight2 = 0.66

Then it's just a matter of putting it together.
Attached Images
File Type: gif weightsbetween.gif (6.2 KB, 11 views)
Reply With Quote top
Reply

  RetouchPRO > Tools > Software


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Filter Forge has been officially released! Craig Walters Software 2 03-06-2007 11:09 AM
FilterMeister - Degrunge Filter byRo Software 17 09-04-2006 03:47 PM
Filter Forge Doug Nelson Software 77 07-06-2006 03:05 PM
Tutorial: Texturizer Filter tricks DannyRaphael Photo-Based Art 6 07-13-2002 03:13 PM
Colored Pencil filter: Stroke direction options DannyRaphael Photo-Based Art 14 06-11-2002 06:27 PM


All times are GMT -6. The time now is 06:50 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
Copyright © 2016 Doug Nelson. All Rights Reserved