Images with negative pixels value

Consider a simple black (0) and white (255) image composed by 3 vertical bands : the first is white, the second is black and the third is white. Image size is W columns by H lines. Band width is W1, W2, W3 for bands 1, 2 and 3 respectively (W1+W2+W3=W).
Consider now a first order edge detecting operation, for example Sobel for vertical edges :
1 0 -1
2 0 -2
1 0 -1
The corresponding edge image is composed of H identical lines (because the image is only varing horizontally). Each line is 0 everywhere, except on transitions : on column W1, there is a positive value of 4*255 and on collumn W1+W2 there is a negative value of -4*255.
Using the following java source code, we obtain an image which have only the positive (>=0) part of each line :
  Image img = (new ImageIcon("bands.png")).getImage();
  BufferedImage bimg = toBufferedImage(img); // not part of JDK1.4
  ConvolveOp sobel = new ConvolveOp(new Kernel(3,3,new float[]{ 1, 0,-1,2,0,-2,1,0,-1})); // vertical Sobel filter
  BufferedImage bimg_cont = sobel.filter(bimg, null);To have an edge image that contains the negative part of edges, we do need a specific image format with specific ColorModel and SampleModel. Ideally, we will need a grayscale image (1 sample/pixel) where all elements can represent values from -4*255 to 4*255. So we need a signed type like DataBuffer.TYPE_SHORT, DataBuffer.TYPE_FLOAT or DataBuffer.TYPE_DOUBLE.
Note : it is possible to apply the filter twice, with a mirrored filter, but time to compute will be also twice the normal computational time (very inefficient).
Now, this is the question : do anyone have a solution to compute a sobel filter (or any other filter type which produces negative values) with a resulting image containing positive and negative values ?

The problem is the size of the number you have to work with. You can store values ranging from 0 to 255 (the max index for a byte-sized variable) so the total numbers you can store is 256. However, if you want to go from -255 to 255, thats about 512 values, which is twice the size of your max. You would need one more bit on that variable to do that. You could make the far left variable be the positive or negative sign (know as a signed variable) which is how computers do it anyway. The only drawback is it will only range from -127 to 127, which is half as much detail.

Similar Messages

  • Want to create a PO with negative net value

    We need to create a PO with negative value, so that we can collect money from vendor with reference with one perticular PO. Vendor owes us money for that PO.
    We paid him $100.00 to do service, however he screwed that work and caused damage. Now he owes us $20.00 plus $100.00(we paid him already) = $120.00.
    Is it possible? Please help.

    create a debit note in FI, or via SD.
    or a return PO

  • PCI 1422. Grab an image with 1 pixel height.

    Hello.
    I'm trying to configure my PCI-1422 board to accquire an image from my custom made line scan camera.
    My camera sends a frame of 1 pixel height (24000px width) to the board. Every 1.9msec (so i should get approx. 526 fps).
    The framegrabber recieves 3 signals: data, pixel clock (12.5MHz) and frame valid signal (i connected it to Enable A pin of PCI-1422).
    The issue is that MAX says to me, that the total fps is 263.
    When I try to get image data in my application (c++) i may recieve even less - only 1/4 of total frames.
    Could you tell me how to configure *.icd file to be able to get 526 (24000x1px, 8bit) fps with my camera?
    Is there any problem with my c++ code?
    You may see my application and *icd file attached.
    Attachments:
    llsequence.h ‏1 KB
    llsequence.c ‏13 KB
    MSU_100_A.zip ‏1 KB

    Alvern,
    How many clock counts rae you waiting between frames?  Have you tried decrasing the ROI further?  You got it set 8 pixels shorter than the actual ccd, have you tried setting it 100 pixels shorter?  What about 1000?  I imagine you're interested in preserving as many pixels as possible, but try testing acquisition with shorter ROI's just to see if a sufficiently short ROI will allow you to acquire at the full frame rate.  
    If adjusting the ROI in addition to enabling fast rearm and Non Continuous Line Enable does not allow you to acquire at the desired frame rate are you able to decrease the frame rate?  If so, what frame rates have you been able to acquire at without losing frames?
    Also, though you are interested in continuous acquisition, have you tried snaping a finite sequence of images?  Try snapping a finite number of images and storing them on the frame grabber to see if you are able to acquire at the full frame rate.
    I suspect altering either the ROI, the frame rate, or the acqusition mode and buffering location will allow you to acquire without missing frames.  Would you be able to test these and post your results?
    David A
    National Instruments
    FlexRIO Product Support Engineer

  • How to convert image to array pixel values in java

    I would like to know how to convert image into arrary of pixels in java ?
    which API should i use ?
    please give me link to a sample program !

    I find the most efficient way to just walk over the image and call getRGB(x,y) on every pixel, more so than Pixelgrabber. If someone knows a more efficient way, give me a beep.

  • How can I properly export an image with corrected pixel aspect ratio?

    Hi, I have a bunch of .png screenshots from old MS-DOS era software that I wish to convert to a 0,8 pixel aspect ratio to simulate the stretch from old CRT monitors.
    I can easily preview it by enabling the pixel aspect ratio correction under the "View" menu, and it looks great. But if I try to "save as" the file as a .png or .gif, it looks blurry and horrible:
    Any hints on how to do this?

    Ok, thanks letting me know. Only last thought is a screen cap of image 2 (that I believe you want) saved to png.
    There's a program called Greenshot that would use the Print screen key and allow you to marquee select and save the shot as a png file. Greenshot - a free and open source screenshot tool for productivity
    That's for Windows, Cmd-Shift-4 on a Mac does the same thing.
    I know it is a pain if you have a hundred of these, but I suppose if you are not in a big hurry you can get it all fixed up.
    Gene

  • Displaying a picture from an array of pixel values

    I have a picture I want to display in an AWT frame. The picture is stored as several arrays of pixel values which represent rectangles.
    Each rectangle has a start co-ordinate and a height and width.
    There is a ColorModel associated with the pixel values, so that's not a problem.
    What's the best way to display these rectangles as pixels, and patch them all together to make the full picture? I'm currently trying to use a MemoryImageSource, but I'm having trouble displaying more than one rectangle at once, and the picture flickers like mad, suggesting MemoryImageSource intended for animation, whereas I just want to display the picture once.
    Any suggestions?

    OK, that looks good. I'm investigating it.
    However, It's not clear how to get the pixel values from an array into it. It requires a WriteableRaster of the pixel data, and to create a WriteableRaster, you need a DataBuffer... which is Abstract!
    Do you know how to make a DataBuffer from an array?

  • The 12 bits image pixel value is negative when shutter time is long

        I use IMAQ 4.0 and PCIe-1429 and CVI, the image bit depth is 12 bit, the problem is when the shutter time is large enough and the pixel value is large than 4095 then all the pixel value of the image become negative,
       I had observed that someone met same issue before and he had solved it through change the attribute parameter inside MAX, but I don't know the detail,
       Can somebody tell me how to solve this issue and explain in more detail?
       Attached file is the icd file of the camera,
    Attachments:
    IPX-11M5-L-new.zip ‏3 KB

    Hello,
    The problem can be due to pixels signedness, U16 instead of I16, check your camera manual.
    Or it can be due to pixel type. Your icd seems to be 12 bit, so it seems OK. But to be sure, send the command to your camera to force it in 12bit.
    Regards

  • -fx-background-position with negative values bug ?

    Hi,
    I've reported an issue that seems to be a bug with negative -fx-backgound-position values in CSS : the background image is painted out of bound of the target node.
    Here is the CSS code:
    /* useradd icon style: with negative offset */
    .icon-useradd {
        -fx-background-position: -90px 0px;
    } I've created a new JIRA issue with attached screenshot :
    http://javafx-jira.kenai.com/browse/RT-25522

    This probably is expected behaviour.
    The properties for background fills (color, insets, radius) donot work together with the properties for background images (image, position, repeat, size). They are separate and painted in separate passes in order, quote from the CSS doc below:
    >
    Each Region consists of several layers, painted from bottom to top, in this order:
    background fills
    background images
    contents
    border strokes
    border images

  • Apex 3.2 SVG Chart - How to plot Stacked Bar With Negative Values ?

    Currently Apex 3.2 Flash Chart (AnyChart 3.x) does not support Stacked bars with negative values.
    I try with SVG Stacked bars with positive values only, chart ploting works fine. When I add a new series with negative values (i.e -1) and I get a blank Chart region with no error.
    Based on this statement from Apex's documentation:
    *"AxisLine Indicates zero on charts that have negative values."*
    I appreciate your help on how to translate this statement into action ?
    (i.e how to override .Axisline class in CSS section ?)
    Thank you very much for your time.

    User614143,
    try to add the minumm negative value (but positive) to the parameter for the axis.
    e.g. show value+3000 (assuming -3000 is the minimum value)
    If you don't have a limitation for the negative values, it doesn't work. (or try to calculate first the most negative value in a before header process)
    hope this helps.
    Leo

  • Service PO Creation With Negative value

    Hi all,
    I am trying to create a Services PO using the BAPI 'BAPI_PO_CREATE1'
    In my scenario, First time PO will create with negative value.
    Then I will remove some conditions in Services line.
    Then PO value will becomes positive.
    When i create the bapi in ME21N, its working fine. Net values of PO become negative.
    But When I try the same using the BAPI, net price of the PO stored as 0(ZERO).
    If I create a PO with positive value using the same BAPI, everything is fine.
    If I change the PO after creation(removing the service line to make bapi value as positive), Net values are doubled since value stored as zero instead of negative value.
    Kindly help me to get out of this issue.
    Note: I need to create a Services PO with negative value using the BAPI
    Thanks in advance.

    Hi,
    No need to create service PO with negative quantity!
    If payment not done for your servicePO, you can cancel invoice document and then revoke SES.
    If any other process involved you can do subsequent debit or subsequent credit  for your service PO in t.code:MIRO.
    Regards,
    Biju K

  • Acquisition of an Asset with Negative value

    Hi Gurus,
    How to do acquisition of an asset with negative value?
    Please tell me the Tcode for doing this transaction.
    Please revert asap.
    Thank You

    Hi,
    The business scenario is.............
    We have to charge some interest on asset last year but we have not charged it.
    Now asset value is zero and if we charge interest on it, it will go to negative.
    That's we are thinking to create new asset with negative value.
    Hope this will help you understand.
    Please revert asap.
    Thank You

  • Service Purchase Order with Negative Value

    Hi Experts,
    is there a method of creating a purchase order of services that can have negative value on it?
    the requirement is that the PO, SES and Invoice of the previously issued PO needs to be adjusted by creating a new Purchase order.
    Please advise.
    Thank you,
    Barakzai.

    Hi,
    No need to create service PO with negative quantity!
    If payment not done for your servicePO, you can cancel invoice document and then revoke SES.
    If any other process involved you can do subsequent debit or subsequent credit  for your service PO in t.code:MIRO.
    Regards,
    Biju K

  • Credit note for invoice with item with negative value

    Hi,
    is it possible to create credit note for invoice, where in one line is negative value (its non stock item).
    There exists 2 possibilities:
    negative qty and positive price (its possible create only through SDK, not SBO)
    positive price and negative qty
    for example
    itemcode 123
    qty -1
    price 1000
    How to create credit note from this invoice?
    Thanks a lot for hints.
    Petr

    Hello Petr Verner,
    It's a standard functionality of Business one, that it is impossible to enter a negative amount in an independant credit note or in a credit note based on a invoice with negative amount.
    To solve this issue:
    1.  For the rows with the positive Row Total, create an "independent" Credit Memo (not based on an Invoice).
    2.  For the rows with the negative Row Total, create another Invoice with a positive Row Total opposite to the original negative Row, and reconcile between the two rows manually via Banking => Bank Statements and Reconciliations => Reconciliation.
    Hope the above helps.
    Wilma Wang
    SAP Business One Forums Team

  • Pixelated images (with High Quality Display turned on)

    Here's my problem: The images look sharp on the internet, but when I download them, place them in Indesign and print them, the look pixelated!
    Take this one for example: http://media.smashingmagazine.com/images/typefaces/productus.gif
    It's resolution is 72 ppi. But when I place it onto the Indesign A4 page (or Letter format for that matter) it occupys almost entire width of the page.
    Why is it so? Why is it so big by default without enlarging it? It's kinda logic that a small 72 ppi image stretched across the whole page will appear blurry when printed on 300 dpi printer.
    So how can I set the indesign page to 300 ppi/dpi so images with lower restion will appear smaller when placed on the page and - will be printed sharp?

    mike.n03 wrote:
    Where can you specify this preference?
    And you mean there's a script for InDesign? Wow, it would be cool to get it. So far I solved that problem by recording an Action in Photoshop and than apply it to all the images using Batch command.
    Preference is down at the bottom of the File Handling section ...  Check the bos to preserve dimensions and a the relinked file will be scaled back to the same size in ID. Uncheck, and the scale percentage will be preserved.
    Almost anything is scriptable in ID (but I don't write them). I recall a script that was posted a year or two ago that would allow you to select an image and type a desired effective resolution into a dialog. The image would get scaled to reach that effective ppi. Your batch action in Photoshop is fine, and useful if you want to palce everything at 100%, but it isn't required to change the resolution in Photshop to achieve what you want. Scaling in ID is exactly the same thing as changing the resolution without resampling in Photoshop. No pixels are added, removed or altered -- only their dispalyed size is changed. If you want a script to set all images to 300 ppi effective resolution, you should probably pay a visit to the scripting forum.

  • Issue with Negative Value for Total valuated stock 0VALSTCKQTY.

    Hi Experts,
    we loaded the Cube with datasources 2LIS_03_BX, 2LIS_03_BF and 2LIS_03_UM.
    We mapped the quanity field from 2LIS_03_BF in transformation either into Key figures "Quantity issued from valuated stock" (0ISSVALSTCK) or "Quantity received into valuated stock" (0RECVALSTCK ) of the cube.
    For obtaining the Total Valuated stock, we used the Key figure 0VALSTCKQTY. This key figure is having the Inflow and Out flow values as 0RECVALSTCK and 0ISSVALSTCK. When i tried to check the content of 0VALSTCKQTY, the key figure  0VALSTCKQTY is not present in the infoCube content. I understood that the value for this key figure would be calculated at the time of query execution with the formula
    { Last obtained Valuated stock + (Received Valuated Stock u2013 Issued Valuated Stock ) }.
    The issue is the first records in the query is obtained with negative value for the total valuated stock 0VALSTCKQTY even though the values of Received Valuated Stock  and  Issued Valuated Stock are with Zero.  Could any one please help me on how the first record in the query is with a negative value eventhough the inflow and out flow fields of it are with Zero.
    Many Thanks in advance.
    Jeswanth

    Hi Srini,
    I observed an interresting reason for the stock being with negative in the first record.
    Issue : While executing the BEx report, we have the first record with a negative value.
    Let me explain with an example
    Material  : XYZ
    Plant      : A
    Date of Stock Initialization for data source 2LIS_03_BX -
    >  12th April 2009.
    So on 12 Th April 2009 consider that we have a stock in store with a value of 2640.
    Then we have loaded wih Data source 2LIS_03_BF for all Historic Movement types.
    At the time of query execution we will have the first record with a negative of available stock present on the day of initialization .
    So, as we have initilized the data source 2LIS_03_BX on 12 th April 2009, we have at that time a stock of 2640 in availability.
    Exactly with the same value of 2640, we are having a negative value i.e. -2640.
    and also one more point to be noted is ...as we have initialized the data source 2LIS_03_BX on 12 th APril 2009...it has created a
    opening balance of 2640 on the day of initiailization i.e on 12 th April 2009 in infocube....(which is an extra record...)...so if the previous record of 12,04,2009 is having some value in it..then it will get added to 2640 EA..which will give incorrect stock
    So in the query the records will appear in the below following manner
    Calendar Day     Total stock                                                                Received stock                                          Issued Stock         
    28.12.2005 --->  - 2640 EA
    29.12.2005 --->    2000 EA                                                                       640 EA                                                        0
    10.04.2009 --->      0                                                                                0                                                               2000 EA      
    11.04.2009 -
    >    0                                                                                0                                                                0          
                                 (For making
                                  the earlier record of  initilization to 0  a negative value -2640 EA is created in the first record )
    12.04.2009 (Initializtion day) --->  2640 EA                                                 0                                                                0
    13.04.2009 
    the day before initialization the total stock will be 0 due to the negative effect introduced by the first record and from the day of initialization the records will be the accurate values...  On 12 th april 2009 we can see that a stock of 2640 is brought into the total stock. In fact if there is no negative value i.e. -2640 in the first record then ...the value on 11.04.2009 will be 2640 Ea and this will get summed up with the Opening balance of 2640 EA created by 2LIS_03_BX on the day of intitialization. So on 12 .04. 2009 the total stock will be shown as 5280 EA...so in order to prevent the double value only we observed that the first record is created with the negative of available stock present on the initialization ...to make the record before the day of initialization i.e. 11.04.2009...to be 0...so that from 12 th April 2009 ..will start to see the actual total stock in the query result...
    This is happening only if we use  both the data sources 2LIS_03_BX and 2LIS_03_BF  for loading into BW.....
    If we load alone by 2LIS_03_BF ...then as 2LIS_03_BX is ruled out in the loading...then no negative of available stock will be created ...because there will be bno opening balance created on the day of initialization.....and the opeing balance available will be flowing into consecutive records due to the movement types and 12 th April 2009 will be shown with avaialable total stock of 2640 EA.
    Kindly let us know your opinions on this...
    Thanks.
    regards,
    Jeswanth

Maybe you are looking for