News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

I would like a lesson

Started by Grincheux, December 08, 2015, 05:18:30 AM

Previous topic - Next topic

FORTRANS

Hi,

Quote from: Siekmanski on December 08, 2015, 12:21:01 PM
Here are 4 methods:

1) The lightness method:
   Averages the most prominent and least prominent colors: (max(R, G, B) + min(R, G, B)) / 2

   I have not seen that used, so I coded it up and ran some tests.
For many images it performs about the same as the standard
gray scale algorithm.  But for images that contain areas that are
a primary (red, blue, green) or secondary (magenta, yellow, cyan)
color the results are quite different.  It was easier to code though.

Cheers,

Steve N.

dedndave

if you want to compare different methods, use an image that has a wide range of colors

dedndave

i used an old version of PicView to convert to gray shades
i don't know if that's good or bad - lol
it looks right to me   :P

guga

About algorithms for image processing. I created some of them for convert different colorspaces. If someone needs it, let me know and i´ll post it here or create a proper thread for that.

About new algorithms, there are some that are used in particle physics that may help on regular software. For example, the approach describe here "Rapid, accurate particle tracking by calculation of radial symmetry centers" http://physics-server.uoregon.edu/~raghu/particle_tracking.html is deeply interesting. Maybe this can be adapted for normal image processing as a better enchantment method.

Didn´t analyzed yet. and honestly, i didn´t understood the math evolved. There have being more then 20 years since i saw those math notations  :greensml: m, Iji , Sum, integrals etc...
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

Grincheux

That would be interesting.
Have you formulas for detecting edge, like soebel?

guga

I guess i have them. Not sure if i ported to asm yet, but i have some of them in C. If you want i can post it for you or translate to Assembly later.
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

Grincheux

I prefer they are translated to asm.
I don't know very well mathematics. When I was 15 I prefered to go on submarines rather than in school!

FORTRANS

Hi,

   I just checked, and I wrote a Sobel filter in 1992.  I rewrote it
somewhat in 2009 as I had forgotten how the code worked, and
my programming style had changed somewhat.  It is 16-bit code
for an eight bit monochrome image.  So if you are really wanting
a Sobel filter, I can post the code later.

   At the time I was apparently playing with various filters, mostly
variations on high pass filtering.  The Sobel was part of an
enhancement algorithm in "Digital Image Processing", first edition,
by William K. Pratt.  He dropped that discussion in the second
edition.

   Maybe someone here has a 32-bit version they would share.

Regards,

Steve N.

Grincheux


guga

For grey converton, here are some i made


;;
    RGBtoGray series v 1.0

    ______________________________________________________________________________________________________________________________
   
    This function converts a colored RGB to grayscalevalue value (from 0 to 255). Grayscale images are represents as shades of gray
    by using luminance Y, given by: Y = 0.298912 × R + 0.586611 × G + 0.114478 × B.
   
    Colors are converted to grey in four ways.  The classic formula is "luma", using the same ratios used by a B&W TV.
    Modern color monitors have different phosphors and respond differently, giving an RGB to grey conversion called "Luminance".
    Some graphics programs use an extremely simplistic "average" method, which is conceptually simple but doesn't match real world response of anything.
   
    Grey Mode   Red         Green       Blue        Format Recommendation (Color Space)
    luma        0.298912    0.586611    0.114478    Rec.601/CCIR601, ITU-R Rec.624-4 System B G, SMPTE 170M.525/59.94/2:1, 625/50/2:1, 1250/50/2:1,
                                                    525/59.94/2:1, 625/50/2:1, 1250/50/2:1
    Luminance   0.212671    0.715160    0.072169    ITU-R BT.709/Rec.709 (HDTV commonly usage).1125/60/2:1, 720/60/1:1,
                                                    1920 x 1080 (SMPTE 274M), 1280 x 720 (SMPTE 296M)
                0.212       0.701       0.087       SMPTE 240M (1125/60/2:1)
    average     0.333333    0.333333    0.333333
   
   
    I released 3 different convertion functions accordying to the format recommendation.
    Each one of them have the same functionality, just variying the resultanting value due to the target device.
   
    RGBtoGray_Rec601 ; common use for regular TV, PCs etc
    RGBtoGray_Rec709 ; usage on HDTV
    RGBtoGray_SMPTE240 ; some HDTV are using this.
    ______________________________________________________________________________________________________________________________


    Members:
   
        Red: (in) A Dword variable that represents the Red Color. It can be any positive value from 0 to 255.
       
        Green: (in) A Dword variable that represents the Red Color. It can be any positive value from 0 to 255.
   
        Blue: (in) A Dword variable that represents the Red Color. It can be any positive value from 0 to 255.
   
    ______________________________________________________________________________________________________________________________

    Examples of usage:

        1)
            call RGBtoGray 243, 221, 180

        2)

            [InputRed: D$ 200
                InputGreen: D$ 12
                InputBlue: D$ 158]
           
            call RGBtoGray D$InputRed, D$InputGreen, D$InputBlue



    ______________________________________________________________________________________________________________________________

    Returned Value:
        The resultant gray value will be returned in eax. It can be a integer value from 0 to 255

    ______________________________________________________________________________________________________________________________
   
    Remarks:
   
        The convertion to grayscale may be a bit confusing, since we can have several ways to convert a RGB to grayscale. It all
        depends of the accuracy we want and the targeted device. (HDTV, B&W Tv, analog TVs etc)
       
       
        For digital formats following CCIR 601 (i.e. most digital standard definition formats), luma is calculated with the formula
        Y' = 0.299 R' + 0.587 G' + 0.114 B'.
        Formats following ITU-R Recommendation BT.709 use the formula Y' = 0.2126 R' + 0.7152 G' + 0.0722 B'.
        Modern HDTV systems use the 709 coefficients, while transitional 1035i HDTV formats may use the SMPTE 240M coefficients
        (Y' = 0.212 R' + 0.701 G' + 0.087 B'). These coefficients correspond to the SMPTE RP 145 primaries (also known as "SMPTE C")
        in use at the time the standard was created.
        The change in the luma coefficients is to provide the "theoretically correct" coefficients that reflects the corresponding
        standard chromaticities ('colors') of the primaries red, green, and blue. However, there is some controversy regarding this decision.
        The difference in luma coefficients requires that component signals must be converted between Rec. 601 and Rec. 709 to provide accurate colors.
        In consumer equipment, the matrix required to perform this conversion may be omitted (to reduce cost), resulting in inaccurate color.
        As well, the Rec. 709 luma coefficients may not necessarily provide better performance. Because of the difference between luma and luminance,
        luma does not exactly represent the luminance in an image. As a result, errors in chroma can affect luminance.
        Luma alone does not perfectly represent luminance; accurate luminance requires both accurate luma and chroma.
        Hence, errors in chroma "bleed" into the luminance of an image.
        Due to the widespread usage of chroma subsampling, 'errors' in chroma typically occur when it is lowered in resolution/bandwidth.
        This lowered bandwidth, coupled with high frequency chroma components, can cause visible errors in luminance.
        An example of a high frequency chroma component would be the line between the green and magenta bars of the SMPTE color bars test pattern.
        Error in luminance can be seen as a dark band that occurs in this area.

        Other values of Luma and Chroma Video Components that can be used to calculate the gray values. (Only uses Y (Luminance) to convert to gray)
       
        Y', R'-Y', B'-Y' commonly used for analog encoding
        Format  1125/60/2:1, 720/60/1:1         525/59.94/2:1, 625/50/2:1, 1250/50/2:1
        Y'      0.2126 R'+0.7152 G'+0.0722 B'   0.299 R' + 0.587 G' + 0.114 B'
        R'-Y'   0.7874 R'–0.7152 G'–0.0722 B'   0.701 R' – 0.587 G' – 0.114 B'
        B'-Y'   –0.2126 R'–0.7152 G'+0.9278 B'  –0.299R' – 0.587 G' + 0.886 B'
       
        Y', P'b, P'r analog component
        Format      1125/60/2:1                 1920 x 1080 (SMPTE 274M)    525/59.94/2:1, 625/50/2:1, 1250/50/2:1
                    (SMPTE 240M)                1280 x 720 (SMPTE 296M)
        Y'          0.212R'+0.701G'+0.087B'     0.2126R'+0.7152G'+0.0722B'  0.299R' + 0.587G' + 0.114B'
        P'b         (B'-Y')/1.826               [0.5/(1–0.0722)](B'-Y')     0.564 (B'-Y')
        P'r         (R'-Y')/1.576               [0.5/(1–0.2126)](R'-Y')     0.713 (R'-Y')
       
        Y', C'b, C'r, scaled and offset for digital quantization

        Format      1920x1080 (SMPTE 274M)          525/59.94/2:1, 625/50/2:1, 1250/50/2:1
                    1280x720 (SMPTE 296M)
        Y'          0.2126 R'+0.7152 G'+0.0722 B'   0.299 R' + 0.587 G' + 0.114 B'
        C'b         0.5389 (B'-Y')+350 mV           0.564 (B'-Y') + 350 mV
        C'r         0.6350 (R'-Y')+350 mV           0.713 (R'-Y') + 350 mV


    ______________________________________________________________________________________________________________________________
    Requirements:
        None

    ______________________________________________________________________________________________________________________________
    See Also:
        Hue_2_RGB
        HLStoRGB
    ______________________________________________________________________________________________________________________________
    Bibliography:
    http://ethesis.nitrkl.ac.in/2876/1/kiran1thesis.pdf
    http://r0k.us/graphics/SIHwheel.html
    http://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.709-5-200204-I!!PDF-E.pdf
    http://www.itu.int/rec/R-REC-BT.709-5-200204-I/en
    http://portal.nersc.gov/svn/visit/branches/2.0RC/third_party/vtk/tags/vtk-5.0.0/Utilities/vtkmpeg2encode/readpic.c
    http://en.wikipedia.org/wiki/Luma_(video)
    http://www.scribd.com/doc/47921551/GuidetoDigitalVideoMeasurements
    http://en.wikipedia.org/wiki/HSL_and_HSV
    http://en.wikipedia.org/wiki/RGB_color_space
    http://mikro.naprvyraz.sk/docs/Coding/Hardware/COLORS.TXT
    http://www.mathworks.com/support/solutions/en/data/1-1ASCU/index.html?product=IP&solution=1-1ASCU
    http://gimp-savvy.com/BOOK/index.html?node54.html
    http://www.bobpowell.net/grayscale.htm
    http://www5.informatik.tu-muenchen.de/lehre/vorlesungen/graphik/info/csc/COL_33.htm
    http://en.wikipedia.org/wiki/YCbCr
    ______________________________________________________________________________________________________________________________   
    Author:
    Gustavo Trigueiros (aka: Beyond2000!)
    v1.0 June/2.011

;;



[GrayRedFactor: R$ 0.298912
GrayGreenFactor: R$ 0.586611
GrayBlueFactor: R$ 0.114478]

; see RGBtoYIQ

Proc RGBtoGray_Rec601:
    Arguments @Red, @Green, @Blue
    Local @Buffer
    uses esi
; G = R*GrayRedFactor+G*GrayGreenFactor+B*BFactor
    lea esi D@Buffer

    fild F@Red | fmul R$GrayRedFactor
    fild F@Green | fmul R$GrayGreenFactor
    faddp ST1 ST0
    fild F@Blue | fmul R$GrayBlueFactor
    faddp ST1 ST0
    fistp F$esi
    mov eax D$esi

EndP

[GrayRedFactor_Rec709: R$ 0.212671
GrayGreenFactor_Rec709: R$ 0.715160
GrayBlueFactor_Rec709: R$ 0.072169]

Proc RGBtoGray_Rec709:
    Arguments @Red, @Green, @Blue
    Local @Buffer
    uses esi

    lea esi D@Buffer

    fild F@Red | fmul R$GrayRedFactor_Rec709
    fild F@Green | fmul R$GrayGreenFactor_Rec709
    faddp ST1 ST0
    fild F@Blue | fmul R$GrayBlueFactor_Rec709
    faddp ST1 ST0
    fistp F$esi
    mov eax D$esi


EndP


[GrayRedFactor_SMPTE240: R$ 0.212
GrayGreenFactor_SMPTE240: R$ 0.701
GrayBlueFactor_SMPTE240: R$ 0.087]

Proc RGBtoGray_SMPTE240:
    Arguments @Red, @Green, @Blue
    Local @Buffer
    uses esi

    lea esi D@Buffer

    fild F@Red | fmul R$GrayRedFactor_SMPTE240
    fild F@Green | fmul R$GrayGreenFactor_SMPTE240
    faddp ST1 ST0
    fild F@Blue | fmul R$GrayBlueFactor_SMPTE240
    faddp ST1 ST0
    fistp F$esi
    mov eax D$esi


EndP

Proc RGBtoLuma:
    Arguments @Red, @Green, @Blue, @Luminance
    uses esi

    mov esi D@Luminance

    fild F@Red | fmul R$GrayRedFactor
    fild F@Green | fmul R$GrayGreenFactor
    faddp ST1 ST0
    fild F@Blue | fmul R$GrayBlueFactor
    faddp ST1 ST0
    fdiv R$Float255
    fstp R$esi

EndP
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

guga

If you need the proper tables for Lab, XYZ (using different white space observers) and the proper matrix table to convert to different RGB work spaces, let me know.  The tables are huge, but here are some of them from my RGBttoXYZ converter

[FloatXYZWorkSpacesMatrices:
FloatAdobe_RGB_1998_D65_Red_M1: R$ 0.5767309  FloatAdobe_RGB_1998_D65_Green_M2: R$ 0.185554     FloatAdobe_RGB_1998_D65_Blue_M3: R$ 0.1881852
FloatAdobe_RGB_1998_D65_Red_M4: R$ 0.2973769  FloatAdobe_RGB_1998_D65_Green_M5: R$ 0.6273491    FloatAdobe_RGB_1998_D65_Blue_M6: R$ 0.0752741
FloatAdobe_RGB_1998_D65_Red_M7: R$ 0.0270343  FloatAdobe_RGB_1998_D65_Green_M8: R$ 0.0706872    FloatAdobe_RGB_1998_D65_Blue_M9: R$ 0.9911085

FloatAppleRGB_D65_Red_M1: R$ 0.4497288        FloatAppleRGB_D65_Green_M2: R$ 0.3162486          FloatAppleRGB_D65_Blue_M3: R$ 0.1844926
FloatAppleRGB_D65_Red_M4: R$ 0.2446525        FloatAppleRGB_D65_Green_M5: R$ 0.6720283          FloatAppleRGB_D65_Blue_M6: R$ 0.0833192
FloatAppleRGB_D65_Red_M7: R$ 0.0251848        FloatAppleRGB_D65_Green_M8: R$ 0.1411824          FloatAppleRGB_D65_Blue_M9: R$ 0.9224628

FloatBest_RGB_D50_Red_M1: R$ 0.6326696        FloatBest_RGB_D50_Green_M2: R$ 0.2045558          FloatBest_RGB_D50_Blue_M3: R$ 0.1269946
FloatBest_RGB_D50_Red_M4: R$ 0.2284569        FloatBest_RGB_D50_Green_M5: R$ 0.7373523          FloatBest_RGB_D50_Blue_M6: R$ 0.0341908
FloatBest_RGB_D50_Red_M7: R$ 0                FloatBest_RGB_D50_Green_M8: R$ 0.0095142          FloatBest_RGB_D50_Blue_M9: R$ 0.8156958

FloatBeta_RGB_D50_Red_M1: R$ 0.6712537        FloatBeta_RGB_D50_Green_M2: R$ 0.1745834          FloatBeta_RGB_D50_Blue_M3: R$ 0.1183829
FloatBeta_RGB_D50_Red_M4: R$ 0.3032726        FloatBeta_RGB_D50_Green_M5: R$ 0.6637861          FloatBeta_RGB_D50_Blue_M6: R$ 0.0329413
FloatBeta_RGB_D50_Red_M7: R$ 0                FloatBeta_RGB_D50_Green_M8: R$ 0.040701           FloatBeta_RGB_D50_Blue_M9: R$ 0.784509

FloatBruce_RGB_D65_Red_M1: R$ 0.4674162       FloatBruce_RGB_D65_Green_M2: R$ 0.2944512         FloatBruce_RGB_D65_Blue_M3: R$ 0.1886026
FloatBruce_RGB_D65_Red_M4: R$ 0.2410115       FloatBruce_RGB_D65_Green_M5: R$ 0.6835475         FloatBruce_RGB_D65_Blue_M6: R$ 0.075441
FloatBruce_RGB_D65_Red_M7: R$ 0.0219101       FloatBruce_RGB_D65_Green_M8: R$ 0.0736128         FloatBruce_RGB_D65_Blue_M9: R$ 0.9933071

FloatCIE_RGB_E_Red_M1: R$ 0.488718            FloatCIE_RGB_E_Green_M2: R$ 0.3106803             FloatCIE_RGB_E_Blue_M3: R$ 0.2006017
FloatCIE_RGB_E_Red_M4: R$ 0.1762044           FloatCIE_RGB_E_Green_M5: R$ 0.8129847             FloatCIE_RGB_E_Blue_M6: R$ 0.0108109
FloatCIE_RGB_E_Red_M7: R$ 0                   FloatCIE_RGB_E_Green_M8: R$ 0.0102048             FloatCIE_RGB_E_Blue_M9: R$ 0.9897952

FloatColorMatch_RGB_D50_Red_M1: R$ 0.5093439  FloatColorMatch_RGB_D50_Green_M2: R$ 0.3209071    FloatColorMatch_RGB_D50_Blue_M3: R$ 0.1339691
FloatColorMatch_RGB_D50_Red_M4: R$ 0.274884   FloatColorMatch_RGB_D50_Green_M5: R$ 0.6581315    FloatColorMatch_RGB_D50_Blue_M6: R$ 0.0669845
FloatColorMatch_RGB_D50_Red_M7: R$ 0.0242545  FloatColorMatch_RGB_D50_Green_M8: R$ 0.1087821    FloatColorMatch_RGB_D50_Blue_M9: R$ 0.6921735

FloatDon_RGB_4_D50_Red_M1: R$ 0.6457711       FloatDon_RGB_4_D50_Green_M2: R$ 0.1933511         FloatDon_RGB_4_D50_Blue_M3: R$ 0.1250978
FloatDon_RGB_4_D50_Red_M4: R$ 0.2783496       FloatDon_RGB_4_D50_Green_M5: R$ 0.6879702         FloatDon_RGB_4_D50_Blue_M6: R$ 0.0336802
FloatDon_RGB_4_D50_Red_M7: R$ 0.0037113       FloatDon_RGB_4_D50_Green_M8: R$ 0.0179861         FloatDon_RGB_4_D50_Blue_M9: R$ 0.8035125

FloatECI_RGB_D50_Red_M1: R$ 0.6502043         FloatECI_RGB_D50_Green_M2: R$ 0.1780774           FloatECI_RGB_D50_Blue_M3: R$ 0.1359384
FloatECI_RGB_D50_Red_M4: R$ 0.3202499         FloatECI_RGB_D50_Green_M5: R$ 0.6020711           FloatECI_RGB_D50_Blue_M6: R$ 0.0776791
FloatECI_RGB_D50_Red_M7: R$ 0                 FloatECI_RGB_D50_Green_M8: R$ 0.067839            FloatECI_RGB_D50_Blue_M9: R$ 0.757371

FloatEkta_Space_PS5_D50_Red_M1: R$ 0.5938914  FloatEkta_Space_PS5_D50_Green_M2: R$ 0.2729801    FloatEkta_Space_PS5_D50_Blue_M3: R$ 0.0973485
FloatEkta_Space_PS5_D50_Red_M4: R$ 0.2606286  FloatEkta_Space_PS5_D50_Green_M5: R$ 0.7349465    FloatEkta_Space_PS5_D50_Blue_M6: R$ 0.0044249
FloatEkta_Space_PS5_D50_Red_M7: R$ 0          FloatEkta_Space_PS5_D50_Green_M8: R$ 0.0419969    FloatEkta_Space_PS5_D50_Blue_M9: R$ 0.7832131

FloatNTSC_RGB_C_Red_M1: R$ 0.6068909          FloatNTSC_RGB_C_Green_M2: R$ 0.1735011            FloatNTSC_RGB_C_Blue_M3: R$ 0.200348
FloatNTSC_RGB_C_Red_M4: R$ 0.2989164          FloatNTSC_RGB_C_Green_M5: R$ 0.586599             FloatNTSC_RGB_C_Blue_M6: R$ 0.1144845
FloatNTSC_RGB_C_Red_M7: R$ 0                  FloatNTSC_RGB_C_Green_M8: R$ 0.0660957            FloatNTSC_RGB_C_Blue_M9: R$ 1.1162243

FloatPAL_SECAM_RGB_D65_Red_M1: R$ 0.430619    FloatPAL_SECAM_RGB_D65_Green_M2: R$ 0.3415419     FloatPAL_SECAM_RGB_D65_Blue_M3: R$ 0.1783091
FloatPAL_SECAM_RGB_D65_Red_M4: R$ 0.2220379   FloatPAL_SECAM_RGB_D65_Green_M5: R$ 0.7066384     FloatPAL_SECAM_RGB_D65_Blue_M6: R$ 0.0713236
FloatPAL_SECAM_RGB_D65_Red_M7: R$ 0.0201853   FloatPAL_SECAM_RGB_D65_Green_M8: R$ 0.1295504     FloatPAL_SECAM_RGB_D65_Blue_M9: R$ 0.9390944

FloatProPhoto_RGB_D50_Red_M1: R$ 0.7976749    FloatProPhoto_RGB_D50_Green_M2: R$ 0.1351917      FloatProPhoto_RGB_D50_Blue_M3: R$ 0.0313534
FloatProPhoto_RGB_D50_Red_M4: R$ 0.2880402    FloatProPhoto_RGB_D50_Green_M5: R$ 0.7118741      FloatProPhoto_RGB_D50_Blue_M6: R$ 0.0000857
FloatProPhoto_RGB_D50_Red_M7: R$ 0            FloatProPhoto_RGB_D50_Green_M8: R$ 0              FloatProPhoto_RGB_D50_Blue_M9: R$ 0.82521

FloatSMPTE_C_RGB_D65_Red_M1: R$ 0.3935891     FloatSMPTE_C_RGB_D65_Green_M2: R$ 0.3652497       FloatSMPTE_C_RGB_D65_Blue_M3: R$ 0.1916313
FloatSMPTE_C_RGB_D65_Red_M4: R$ 0.2124132     FloatSMPTE_C_RGB_D65_Green_M5: R$ 0.7010437       FloatSMPTE_C_RGB_D65_Blue_M6: R$ 0.0865432
FloatSMPTE_C_RGB_D65_Red_M7: R$ 0.0187423     FloatSMPTE_C_RGB_D65_Green_M8: R$ 0.1119313       FloatSMPTE_C_RGB_D65_Blue_M9: R$ 0.9581563

FloatsRGB_D65_Red_M1: R$ 0.4124564            FloatsRGB_D65_Green_M2: R$ 0.3575761              FloatsRGB_D65_Blue_M3: R$ 0.1804375
FloatsRGB_D65_Red_M4: R$ 0.2126729            FloatsRGB_D65_Green_M5: R$ 0.7151522              FloatsRGB_D65_Blue_M6: R$ 0.0721750
FloatsRGB_D65_Red_M7: R$ 0.0193339            FloatsRGB_D65_Green_M8: R$ 0.1191920              FloatsRGB_D65_Blue_M9: R$ 0.9503041

FloatWide_Gamut_RGB_D50_Red_M1: R$ 0.7161046  FloatWide_Gamut_RGB_D50_Green_M2: R$ 0.1009296    FloatWide_Gamut_RGB_D50_Blue_M3: R$ 0.1471858
FloatWide_Gamut_RGB_D50_Red_M4: R$ 0.2581874  FloatWide_Gamut_RGB_D50_Green_M5: R$ 0.7249378    FloatWide_Gamut_RGB_D50_Blue_M6: R$ 0.0168748
FloatWide_Gamut_RGB_D50_Red_M7: R$ 0          FloatWide_Gamut_RGB_D50_Green_M8: R$ 0.0517813    FloatWide_Gamut_RGB_D50_Blue_M9: R$ 0.7734287


FloatAdobe_RGB_1998_D50_M1: R$ 0.6097559      FloatAdobe_RGB_1998_D50_M2: R$ 0.2052401          FloatAdobe_RGB_1998_D50_M3: R$ 0.1492240
FloatAdobe_RGB_1998_D50_M4: R$ 0.3111242      FloatAdobe_RGB_1998_D50_M5: R$ 0.6256560          FloatAdobe_RGB_1998_D50_M6: R$ 0.0632197
FloatAdobe_RGB_1998_D50_M7: R$ 0.0194811      FloatAdobe_RGB_1998_D50_M8: R$ 0.0608902          FloatAdobe_RGB_1998_D50_M9: R$ 0.7448387

FloatAppleRGB_D50_M1: R$ 0.4755678            FloatAppleRGB_D50_M2: R$ 0.3396722                FloatAppleRGB_D50_M3: R$ 0.1489800
FloatAppleRGB_D50_M4: R$ 0.2551812            FloatAppleRGB_D50_M5: R$ 0.6725693                FloatAppleRGB_D50_M6: R$ 0.0722496
FloatAppleRGB_D50_M7: R$ 0.0184697            FloatAppleRGB_D50_M8: R$ 0.1133771                FloatAppleRGB_D50_M9: R$ 0.6933632

FloatBruce_RGB_D50_M1: R$ 0.4941816           FloatBruce_RGB_D50_M2: R$ 0.3204834               FloatBruce_RGB_D50_M3: R$ 0.1495550
FloatBruce_RGB_D50_M4: R$ 0.2521531           FloatBruce_RGB_D50_M5: R$ 0.6844869               FloatBruce_RGB_D50_M6: R$ 0.0633600
FloatBruce_RGB_D50_M7: R$ 0.0157886           FloatBruce_RGB_D50_M8: R$ 0.0629304               FloatBruce_RGB_D50_M9: R$ 0.7464909

FloatCIE_RGB_D50_M1: R$ 0.4868870             FloatCIE_RGB_D50_M2: R$ 0.3062984                 FloatCIE_RGB_D50_M3: R$ 0.1710347
FloatCIE_RGB_D50_M4: R$ 0.1746583             FloatCIE_RGB_D50_M5: R$ 0.8247541                 FloatCIE_RGB_D50_M6: R$ 0.0005877
FloatCIE_RGB_D50_M7: R$ -0.0012563            FloatCIE_RGB_D50_M8: R$ 0.0169832                 FloatCIE_RGB_D50_M9: R$ 0.8094831

FloatNTSC_RGB_D50_M1: R$ 0.6343706            FloatNTSC_RGB_D50_M2: R$ 0.1852204                FloatNTSC_RGB_D50_M3: R$ 0.1446290
FloatNTSC_RGB_D50_M4: R$ 0.3109496            FloatNTSC_RGB_D50_M5: R$ 0.5915984                FloatNTSC_RGB_D50_M6: R$ 0.0974520
FloatNTSC_RGB_D50_M7: R$ -0.0011817           FloatNTSC_RGB_D50_M8: R$ 0.0555518                FloatNTSC_RGB_D50_M9: R$ 0.7708399

FloatPAL_SECAM_RGB_D50_M1: R$ 0.4552773       FloatPAL_SECAM_RGB_D50_M2: R$ 0.3675500           FloatPAL_SECAM_RGB_D50_M3: R$ 0.1413926
FloatPAL_SECAM_RGB_D50_M4: R$ 0.2323025       FloatPAL_SECAM_RGB_D50_M5: R$ 0.7077956           FloatPAL_SECAM_RGB_D50_M6: R$ 0.0599019
FloatPAL_SECAM_RGB_D50_M7: R$ 0.0145457       FloatPAL_SECAM_RGB_D50_M8: R$ 0.1049154           FloatPAL_SECAM_RGB_D50_M9: R$ 0.7057489

FloatSMPTE_C_RGB_D50_M1: R$ 0.4163290         FloatSMPTE_C_RGB_D50_M2: R$ 0.3931464             FloatSMPTE_C_RGB_D50_M3: R$ 0.1547446
FloatSMPTE_C_RGB_D50_M4: R$ 0.2216999         FloatSMPTE_C_RGB_D50_M5: R$ 0.7032549             FloatSMPTE_C_RGB_D50_M6: R$ 0.0750452
FloatSMPTE_C_RGB_D50_M7: R$ 0.0136576         FloatSMPTE_C_RGB_D50_M8: R$ 0.0913604             FloatSMPTE_C_RGB_D50_M9: R$ 0.7201920

FloatsRGB_D50_M1: R$ 0.4360747                FloatsRGB_D50_M2: R$ 0.3850649                    FloatsRGB_D50_M3: R$ 0.1430804
FloatsRGB_D50_M4: R$ 0.2225045                FloatsRGB_D50_M5: R$ 0.7168786                    FloatsRGB_D50_M6: R$ 0.0606169
FloatsRGB_D50_M7: R$ 0.0139322                FloatsRGB_D50_M8: R$ 0.0971045                    FloatsRGB_D50_M9: R$ 0.7141733

FloatsRGB_D65_Red_HDTV_M1: R$ 0.4124564       FloatsRGB_D65_Green_HDTV_M2: R$ 0.3575761         FloatsRGB_D65_Blue_HDTV_M3: R$ 0.1804375
FloatsRGB_D65_Red_HDTV_M4: R$ 0.2126729       FloatsRGB_D65_Green_HDTV_M5: R$ 0.7151522         FloatsRGB_D65_Blue_HDTV_M6: R$ 0.0721750
FloatsRGB_D65_Red_HDTV_M7: R$ 0.0193339       FloatsRGB_D65_Green_HDTV_M8: R$ 0.1191920         FloatsRGB_D65_Blue_HDTV_M9: R$ 0.9503041]
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

Grincheux

Ok, I will use them.
I have three projects at the same time and only one head.

FORTRANS

Hi,

   Here it is.  The original image format was column ordered 750 x 480.
One byte per pixel.  Pixels surrounding the central pixel are labeled
A0 through A7, point of interest is f(i,k), and the calculated Sobel
function is G(i,k).  The JL (jump less) should probably be JBE (jump
below or equal) but either work in practice.


; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SOBELDAT DW     (?)             ; Value from Sobel algorithm.

; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
COMMENT\
See Digital Image Processing by Pratt 1st ed., page 487.

  G(j,k) = SQRT( X^2 + Y^2 ), where X = (A2 + 2A3 + A4) - (A0 + 2A7 + A6)
                                    Y = (A0 + 2A1 + A2) - (A6 + 2A5 + A4)
  A0   A1   A2
  A7  f(ik) A3
  A6   A5   A4
\
SOBEL:
;@      FINIT           ; Initialize 8087 (Needs to be done somewhere before calling Sobel.)
        XOR     AX,AX   ; X1
        XOR     BX,BX   ; X2
        XOR     CX,CX   ; Y1
        XOR     DX,DX   ; Y2

        ADD     BL,ES:[DI-479]  ; A0
        ADC     BH,0
        ADD     CL,ES:[DI-479]  ; A0
        ADC     CH,0
        ADD     BL,ES:[DI-480]  ; A7
        ADC     BH,0
        ADD     BL,ES:[DI-480]  ; A7
        ADC     BH,0
        ADD     BL,ES:[DI-481]  ; A6
        ADC     BH,0
        ADD     DL,ES:[DI-481]  ; A6
        ADC     DH,0
        ADD     CL,ES:[DI-1]    ; A1
        ADC     CH,0
        ADD     CL,ES:[DI-1]    ; A1
        ADC     CH,0
        ADD     DL,ES:[DI+1]    ; A5
        ADC     DH,0
        ADD     DL,ES:[DI+1]    ; A5
        ADC     DH,0
        ADD     AL,ES:[DI+479]  ; A2
        ADC     AH,0
        ADD     CL,ES:[DI+479]  ; A2
        ADC     CH,0
        ADD     AL,ES:[DI+480]  ; A3
        ADC     AH,0
        ADD     AL,ES:[DI+480]  ; A3
        ADC     AH,0
        ADD     AL,ES:[DI+481]  ; A4
        ADC     AH,0
        ADD     DL,ES:[DI+481]  ; A4
        ADC     DH,0

        SUB     AX,BX    ; Make X
        SUB     CX,DX    ; Make Y
        MOV     SOBELDAT,AX
        FILD    SOBELDAT ; load X into 8087
        FIMUL   SOBELDAT

        MOV     SOBELDAT,CX
        FILD    SOBELDAT ; load Y into 8087
        FIMUL   SOBELDAT

        FADD
        FSQRT
        FISTP   SOBELDAT

        XOR     AX,AX
        ADD     AX,SOBELDAT     ; Set Flags

        JNS     POSITIVE
        MOV     AX,0
POSITIVE:
        CMP     AX,255
        JL      NoClamp
        MOV     AX,255
NoClamp:

        RET

; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


HTH,

Steve N.

Grincheux

You are quicker than I.
:t

Thanks. I take all