Google
  Web www.spinics.net

Re: Script writing - help request

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Let's see.
I do this with the GIMP since it is the image manipulation program I have.  And i do it because I need to get good results in the lab.

The camera is a Nikon D50, but that is inconsequential as I can not manipulate the camera itself. Just the images and the images are manipulated in GIMP.  
The camera exposes the images not always teh same way which is really a PITA, and in order to compare the images one to the other I need to have a standardized base.
After some monkeying around I found that doing those actions provdes with a consistentbae line and thus I can compare images one to the other.

However one test produces 100+ images and I wanted to script so that it was easier to modify all of them.

The main problem is that the script I wrote is not working properly and I do not know how to test it, each of the steps works fine in the script-fu console but once it is together something is wrong.  I attach the non-workng script

 => What the script needs to do is:
 
 => - measure the value of an area of about 20 pixels ->
 =>   RGB values
 
 => - make that the WHITE value, i.e. adjust the levels
 =>   of each color to a maximum given by the RGB values
 =>   above
 
 => - Measure RGB values in 2 other locations that will
 =>   be my colorimetric measurements (sample-average 20
 =>   pixels is fine).
 

;; lab_colorimetry.scm
;
;; A gimp script to adjust levels in colorimetry photographs,
;; bringing white point to the value of the background light


(define (script-fu-lab-colors img 
            drawable 
            lab-colors) 

;;Read image name and generate corrected name
(set! corrected_file_name ( + (gimp-image-get-filename image) "c") )

 ;; Define the points where to measure the color of the white background and measure the RGB values

(set! colorofset (gimp-image-pick-color img drawable 1550 1100 1 1 20))

;;set the max values for each color channel

(set! red_ofset (car (colorofset)))
(set! blue_ofset (cadr (colorofset)))
(set! green_ofset (caddr (colorofset)))


 ;; ADjust white point for red
(gimp-levels drawable 1 0 red_ofset 1 0 255)

 ;; ADjust white point for green
(gimp-levels drawable 2 0 green_ofset 1 0 255)

 ;; ADjust white point for blue
(gimp-levels drawable 3 0 blue_ofset 1 0 255)

;;Save image
(file-jpeg-save 100 img drawable corrected_file_name "" 100 0 0 0 "corrected image" 0 0 0 0)

)  ;;end of script
 
;; ready to register in script-fu DB
(script-fu-register "lab-colors"
                    "Correct colorimetry fotos"
                    "Script to adjust images for color analysis"        
                    "titrisol"
                "(c) U FoodScience Lab"
                 "October 2007"
                "RGB*"
                SF-IMAGE "img" 0
                SF-DRAWABLE "drawable" 0
)

(script-fu-menu-register "lab-colors"  "<Toolbox>/Xtns/Script-Fu/Utils")

 


Kent Paul Dolan <xanthian@xxxxxxxx> wrote:                               => From: "titrisol" <titrisol@xxxxxxxxx>
 => Date: Tue, 16 Oct 2007 10:00:11 -0000
 
 => I'm trying to write a very specific script for an
 => application which requires colorimetric measurments
 => in the lab.
 
 => The image contains a back-light and 2 samples of
 => different colors.  The digi-cam is fixed so the
 => location of those 3 elements remains constant.
 
 Are you somehow trying to do this with GIMP and GIMP
 scripting?
 
 If so, why?
 
 It seems like a very device specific application,
 yet you don't even mention the brand or
 specifications of the device used, just "digi-cam".
 
 GIMP is not a camera control application, it is an
 image modification application. Probably you need a
 users group for the digital camera, not for GIMP, to
 get information about how to write sampling scripts
 for that camera.
 
 => What the script needs to do is:
 
 => - measure the value of an area of about 20 pixels ->
 =>   RGB values
 
 => - make that the WHITE value, i.e. adjust the levels
 =>   of each color to a maximum given by the RGB values
 =>   above
 
 => - Measure RGB values in 2 other locations that will
 =>   be my colorimetric measurements (sample-average 20
 =>   pixels is fine).
 
 => Can anyone give me a hand with this?
 => I have written a draft version but doesn't seem to work.
 
 xanthian.
 
     
                               

       
---------------------------------
Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase.

[Non-text portions of this message have been removed]



List archives: <http://groups.yahoo.com/group/gimpwin-users/>
To unsubscribe send a blank message from the address you're subscribed
to <mailto:gimpwin-users-unsubscribe@xxxxxxxxxxxxxxx> 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/gimpwin-users/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/gimpwin-users/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:gimpwin-users-digest@xxxxxxxxxxxxxxx 
    mailto:gimpwin-users-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    gimpwin-users-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Add to Google

[Gimp Developers]     [Gimp Users]     [Photos]     [Yosemite News]     [Yosemite Photos]    [Epson Inkjet]     [Scanner]     [Gimp's Home]     [GIMP Books]     [Steve's Art]     [Script Fu]     [Free Online Dating]

  Powered by Linux