Image Processing - How to find a pixel cordinates in iOS ?

Hi,
I want to know how to find the cordinates of the pixel which i am chaging.
Here is what i am doing.
CGImageRef imgSource = self.ImageView.image.CGImage;
    CFDataRef m_DataRed1 = CGDataProviderCopyData(CGImageGetDataProvider(imgSource));
    CGFloat myheight;
    CGFloat mywidth;
    myheight= CGImageGetHeight(imgSource);
    mywidth = CGImageGetWidth(imgSource);
    UInt8 *dataOrignal = (UInt8 *)CFDataGetBytePtr(m_DataRed1);
    double lenghtSource = CFDataGetLength(m_DataRed1);
    NSLog(@"lenght : %f",lenghtSource);
    int bytesPerPixel_ = CGImageGetBitsPerPixel(imgSource)/8;
    size_t bytesPerRow = CGImageGetBytesPerRow(imgSource);
    NSLog(@"height = %f, width = %f, bytesperPixel = %d",myheight,mywidth,bytesPerPixel_);
    for(int x = 0; x < myheight; x++)
        for(int y = 0; y < mywidth; y++)
            int pixelStartIndex = bytesPerPixel_*((bytesPerRow*x)+y);
//            if (pixelStartIndex <= lenghtSource) {
                UInt8 alphaVal = dataOrignal[pixelStartIndex];
                UInt8 redVal = dataOrignal[pixelStartIndex + 1];
                UInt8 greenVal = dataOrignal[pixelStartIndex + 2];
                UInt8 blueVal = dataOrignal[pixelStartIndex + 3];
                if(redVal == 236 || alphaVal == 236 || greenVal == 236)
                    dataOrignal[pixelStartIndex] = 255;
                    dataOrignal[pixelStartIndex +1] = 0;
                    dataOrignal[pixelStartIndex +2] = 0;
                    dataOrignal[pixelStartIndex+3]= 255;
                    NSLog(@"x %d, y = %d, index = %d", x, y,pixelStartIndex);
    NSUInteger width = CGImageGetWidth(imgSource); //202
    NSUInteger height = CGImageGetHeight(imgSource);//173
    size_t bitsPerComponent = CGImageGetBitsPerComponent(imgSource);
    size_t bitsPerPixel = CGImageGetBitsPerPixel(imgSource);
    NSLog(@"the width = %u and height=%u of the image is ",width,height );
    NSLog(@"the bits per component is %zd", bitsPerComponent);
    NSLog(@"the bits per pixel is %zd", bitsPerPixel);
    NSLog(@"the bytes per row is %zd" , bytesPerRow);
    CGColorSpaceRef colorspace = CGImageGetColorSpace(imgSource);
    CGBitmapInfo bitmapInfo = CGImageGetBitmapInfo(imgSource);
    CFDataRef newData = CFDataCreate(NULL, dataOrignal, lenghtSource);
    CGDataProviderRef provider = CGDataProviderCreateWithCFData(newData);
    CGContextRef context = CGBitmapContextCreate(newData, width, height, bitsPerComponent, bytesPerRow, colorspace, bitmapInfo);
    CGPoint point = CGContextGetTextPosition(context);
    NSInteger xx =  point.x;
//    point.y;
    NSLog(@"this is the value of x axis %d",xx);
    CGImageRef newImg = CGImageCreate(width, height, bitsPerComponent, bitsPerPixel, bytesPerRow, colorspace, bitmapInfo, provider, NULL, true, kCGRenderingIntentDefault);
    UIImage *newImage1 = [UIImage imageWithCGImage:newImg];
    self.ImageView.image = newImage1;
is this the right way to parse the image using x & y ?
I dont know if the pixelstartIndex is correct or not, but it does change the pixels.
I want to make sure if the x & y i am NSLogging is correct or not.
Thanks in Advance

BufferedImage img = null;
DataBufferByte imgRasterBuffer = null;
int imgColors[][];
URL url = BumpMap1.class.getResource("bumpmap1/img.png");
try
img = ImageIO.read(url);
catch(java.io.IOException x)
System.out.println(x.getMessage());
imgWidth = img.getWidth();
imgHeight = img.getHeight();
imgRasterBuffer = (DataBufferByte)(img.getRaster().getDataBuffer());
imgColors = new int[imgWidth * imgHeight][3];
// Store RGB values into array
for (int x = 0; x < imgWidth; x++)
for (int y = 0; y < imgHeight; y++)
int c = img.getRGB(x, y);
int loc = y * imgWidth + x;
imgColors[loc][0] = (c&(255<<16))>>16;
imgColors[loc][1] = (c&(255<<8))>>8;
imgColors[loc][2] = c&255;
if(imgColors[pixX+(pixY*imgWidth)][0] == 0 &&
imgColors[pixX+(pixY*imgWidth)][1] == 0 &&
imgColors[pixX+(pixY*imgWidth)][2] == 0)
// it's black

Similar Messages

  • Image Processing Algorithms - From Matlab to Pixel Bender

    Hello.
    Got a few Image Processing (Mainly Image Enhancement) Algorithms I created in Matlab.
    I would like to make them run on Photoshop, Create a Plug In out of it.
    Would Pixel Bender be the right way doing it?
    The Algorithms mainly use Convolutions and Fourier Domain operations.
    All I need is a simple Preview Window and few Sliders, Dropbox and Buttons.
    I'd appreciate your help.

    pixel vs float - Couldn't figure out what exactly is the difference if there is at all. I assume Pixel always get clipped into [0 1] and float won't until it gets to be shown on the screen as an output?
    There is no difference between them. At one stage of development we had some ideas about the way the pixel type should work that would make it different to float, but the ideas never came to anything and by the time we realized that it was too late to change. It's #1 on my list of "mistakes we made when developing Pixel Bender".
    Regions - Let me see if I get is straight. For the example assuming Gaussian Blur Kernel of Radius 5 (Not the STD, but the radius - a 11x11 Matrix). I should use "needed()" in order to define the support of each pixel output in the input image. I should do it to make sure no one changes those values before the output pixel is calculated.
    Now, In the documentation is goes needed(region outputRegion, imageRef inputIndex). Should I assume that at default the outputRegion is actually the sampled pixel in the input? Now I use outset(outputRegion, float2(x, y)) to enlarge the "Safe Zone". I don't get this float2 number. Let's say it's (4, 3) and the current pixel is (10, 10). Now the safe zone goes 4 pixel to the left, 4 to the right, 3 up and 3 down? I assume it actually creates a rectangle area, right? Back to our example I should set outset(outputRegion, float2(5.0, 5.0)) right?
    Needed is the function the system calls to answer the question "what area of the input do I need in order to calculate a particular area of the output?".
    I should do it to make sure no one changes those values before the output pixel is calculated.
    No, you should do it to make sure the input pixel values needed to compute the output pixel values have been calculated and stored.
    Should I assume that at default the outputRegion is actually the sampled pixel in the input?
    No. When "the system" (i.e. After Effects, PB toolkit or the Photoshop plugin) decides it wants to display a particular area of the output, it will call the needed function with that area in the outputRegion parameter. The job of the needed function is to take whatever output region it is given and work out what input area is required to compute it correctly.
    Let's say it's (4, 3) and the current pixel is (10, 10).
    Don't think in terms of "current pixel" when you're looking at the needed function. The region functions are not called on a per-pixel basis, they are called once at the start of computing the frame, before we do the computation for each pixel.
    Back to our example I should set outset(outputRegion, float2(5.0, 5.0)) right?
    Yes - you're correct. Whatever size the output region is, you require an input region that has an additional border of 5 pixels all round to calculate it correctly.

  • How To Find Dead Pixels

    I just purchased the Apple 23" Display and have been reading this forum about dead pixels. How can I check my new display for dead pixels.
    I have a Dell Computer with Window XP home OS. Any help would be most appreciated. So far everything is working just fine with this display and I am quite pleased. But I want to make sure that everything is working properly.

    You don't need to "find" dead pixels. Unless your vision is seriously impaired, you will see them just fine. If you don't see any you probably don't have any so don't worry about it.

  • How to find exact pixels

    I'd like to know if you could pull up a window in PSE 4 that told you the exact position of your brush, like in Paint
    (See picture) . You know, that handy little status bar?

    Window > Info

  • How will find tables involved in datasource 2LIS_40_S278

    Hi Experts,
    Can you tell me the tables involved in datasource 2LIS_40_S278 and process how will find the details of tables related to a particular datasource??
    Thanks in advance!
    Sapna

    Hi,
    Below are the tables related to this Data source 2LIS_40_S278
    MAPE                             Article Master: Export Control File
    MAPEWG                           Article master: Preference determination: Cross-sit
    S035                             Statistics: Batch Stocks
    S430                             SIS: (OIL-TSW) Sales document statistics by TSW object
    S474                             Pendulum List - Confirmation
    STKO                             BOM Header
    T415B                            Alternative Determination by Unit of Measure
    TWISPA_AVERAGERT                 Merchandise and Assortment Planning: Average Retail
    But the Data source 2LIS_40_S278 is replaced with Datasouce 2LIS_03_BX.
    Check this link.
    http://help.sap.com/saphelp_nw04/helpdata/en/fb/64073c52619459e10000000a114084/frameset.htm
    Veerendra.

  • How to find my ipad  i flost

    how to find my ipad if lost

    Apple (and no one else) can not assist (with serial number or iCloud) in finding a lost or stolen iPad.
    Report to police along with serial number. Change all your passwords.
    These links may be helpful.
    How to Track and Report Stolen iPad
    http://www.ipadastic.com/tutorials/how-to-track-and-report-stolen-ipad
    Reporting a lost or stolen Apple product
    http://support.apple.com/kb/ht2526
    What to do if your iOS device is lost or stolen
    http://support.apple.com/kb/HT5668
    iCloud: Locate your device on a map
    http://support.apple.com/kb/PH2698
    Report Stolen iPad Tips and iPad Theft Prevention
    http://www.stolen-property.com/report-stolen-ipad.php
    How to recover a lost or stolen iPad
    http://ipadhelp.com/ipad-help/how-to-recover-a-lost-or-stolen-ipad/
    How to Find a Stolen iPad
    http://www.ehow.com/how_7586429_stolen-ipad.html
    What NOT to do if your iPhone or iPad is lost or stolen
    http://www.tomahaiku.com/what-not-to-do-if-your-iphone-or-ipad-lost-or-stolen/
    Apple Product Lost or Stolen
    http://sites.google.com/site/appleclubfhs/support/advice-and-articles/lost-or-st olen
    Oops! iForgot My New iPad On the Plane; Now What?
    http://online.wsj.com/article/SB10001424052702303459004577362194012634000.html
    If you don't know your lost/stolen iPad's serial number, use the instructions below. The S/N is also on the iPad's box.
    How to Find Your iPad Serial Number
    http://www.ipadastic.com/tutorials/how-to-find-your-ipad-serial-number
    iOS: How to find the serial number, IMEI, MEID, CDN, and ICCID number
    http://support.apple.com/kb/HT4061
     Cheers, Tom

  • I update my iphone 4g .now not working how to find old firmware version

    i update my iphone 4g to newer version ios 7.now not working how to find old firmware version

    Downgrading the iOS version is not supported by Apple.
    Without know how it is not working:
    Try:
    - Reset the iOS device. Nothing will be lost      
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Reset all settings                            
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup. See:                                               
    iOS: Back up and restore your iOS device with iCloud or iTunes
    - Restore to factory settings/new iOS device.                       
    If still problem, make an appointment at the Genius Bar of an Apple store since it appears you have a hardware problem.
      Apple Retail Store - Genius Bar                                              
    BTW you posted in the iPod touch forum

  • How to find my ipad2

    my Ipad has stolen by someone, please help me to find it soon.
    I put it in my bag, the thief stolen all the thing's. please help me.

    If the iPad was running iOS 7, the thief will not ever be able to use it.
    iCloud: Find My iPhone Activation Lock in iOS 7
    http://support.apple.com/kb/HT5818
    Apple (and no one else) can not assist (with serial number or iCloud) in finding a lost or stolen iPad.
    Report to police along with serial number. Change all your passwords.
    These links may be helpful.
    How to Track and Report Stolen iPad
    http://www.ipadastic.com/tutorials/how-to-track-and-report-stolen-ipad
    Reporting a lost or stolen Apple product
    http://support.apple.com/kb/ht2526
    What to do if your iOS device is lost or stolen
    http://support.apple.com/kb/HT5668
    iCloud: Locate your device on a map
    http://support.apple.com/kb/PH2698
    iCloud: Lost Mode - Lock and Trace
    http://support.apple.com/kb/PH2700
    iCloud: Remotely Erase your device
    http://support.apple.com/kb/PH2701
    Report Stolen iPad Tips and iPad Theft Prevention
    http://www.stolen-property.com/report-stolen-ipad.php
    How to recover a lost or stolen iPad
    http://ipadhelp.com/ipad-help/how-to-recover-a-lost-or-stolen-ipad/
    How to Find a Stolen iPad
    http://www.ehow.com/how_7586429_stolen-ipad.html
    What NOT to do if your iPhone or iPad is lost or stolen
    http://www.tomahaiku.com/what-not-to-do-if-your-iphone-or-ipad-lost-or-stolen/
    Apple Product Lost or Stolen
    http://sites.google.com/site/appleclubfhs/support/advice-and-articles/lost-or-st olen
    Oops! iForgot My New iPad On the Plane; Now What?
    http://online.wsj.com/article/SB10001424052702303459004577362194012634000.html
    If you don't know your lost/stolen iPad's serial number, use the instructions below. The S/N is also on the iPad's box.
    How to Find Your iPad Serial Number
    http://www.ipadastic.com/tutorials/how-to-find-your-ipad-serial-number
    iOS: How to find the serial number, IMEI, MEID, CDN, and ICCID number
    http://support.apple.com/kb/HT4061
     Cheers, Tom

  • How to find serial no

    how to find serial no

    If the iPad was running iOS 7, the thief will not ever be able to use it.
    iCloud: Find My iPhone Activation Lock in iOS 7
    http://support.apple.com/kb/HT5818
    Apple (and no one else) can not assist (with serial number or iCloud) in finding a lost or stolen iPad.
    Report to police along with serial number. Change all your passwords.
    These links may be helpful.
    How to Track and Report Stolen iPad
    http://www.ipadastic.com/tutorials/how-to-track-and-report-stolen-ipad
    Reporting a lost or stolen Apple product
    http://support.apple.com/kb/ht2526
    What to do if your iOS device is lost or stolen
    http://support.apple.com/kb/HT5668
    iCloud: Locate your device on a map
    http://support.apple.com/kb/PH2698
    iCloud: Lost Mode - Lock and Trace
    http://support.apple.com/kb/PH2700
    iCloud: Remotely Erase your device
    http://support.apple.com/kb/PH2701
    Report Stolen iPad Tips and iPad Theft Prevention
    http://www.stolen-property.com/report-stolen-ipad.php
    How to recover a lost or stolen iPad
    http://ipadhelp.com/ipad-help/how-to-recover-a-lost-or-stolen-ipad/
    How to Find a Stolen iPad
    http://www.ehow.com/how_7586429_stolen-ipad.html
    What NOT to do if your iPhone or iPad is lost or stolen
    http://www.tomahaiku.com/what-not-to-do-if-your-iphone-or-ipad-lost-or-stolen/
    Apple Product Lost or Stolen
    http://sites.google.com/site/appleclubfhs/support/advice-and-articles/lost-or-st olen
    Oops! iForgot My New iPad On the Plane; Now What?
    http://online.wsj.com/article/SB10001424052702303459004577362194012634000.html
    If you don't know your lost/stolen iPad's serial number, use the instructions below. The S/N is also on the iPad's box.
    How to Find Your iPad Serial Number
    http://www.ipadastic.com/tutorials/how-to-find-your-ipad-serial-number
    iOS: How to find the serial number, IMEI, MEID, CDN, and ICCID number
    http://support.apple.com/kb/HT4061
     Cheers, Tom

  • How to find i pad

        KINDLY help me I had Ipad 3g 64G  before two days has been stolen and I don't knowwhat can I do , the problem  I did not active the option in I could to find my device ,  but still I have the box .
    Please if there is any one could help me to find it . I don't know  how to ask Apple team to help me and at least find it or block it .
    Thanks to all

    Apple (and no one else) can not assist (with serial number or iCloud) in finding a lost or stolen iPad.
    Report to police along with serial number. Change all your passwords.
    These links may be helpful.
    How to Track and Report Stolen iPad
    http://www.ipadastic.com/tutorials/how-to-track-and-report-stolen-ipad
    Reporting a lost or stolen Apple product
    http://support.apple.com/kb/ht2526
    iCloud: Locate your device on a map
    http://support.apple.com/kb/PH2698
    Report Stolen iPad Tips and iPad Theft Prevention
    http://www.stolen-property.com/report-stolen-ipad.php
    How to recover a lost or stolen iPad
    http://ipadhelp.com/ipad-help/how-to-recover-a-lost-or-stolen-ipad/
    iCloud: Locate your device on a map
    http://support.apple.com/kb/PH2698
    How to Find a Stolen iPad
    http://www.ehow.com/how_7586429_stolen-ipad.html
    What NOT to do if your iPhone or iPad is lost or stolen
    http://www.tomahaiku.com/what-not-to-do-if-your-iphone-or-ipad-lost-or-stolen/
    Apple Product Lost or Stolen
    http://sites.google.com/site/appleclubfhs/support/advice-and-articles/lost-or-st olen
    Oops! iForgot My New iPad On the Plane; Now What?
    http://online.wsj.com/article/SB10001424052702303459004577362194012634000.html
    If you don't know your lost/stolen iPad's serial number, use the instructions below. The S/N is also on the iPad's box.
    How to Find Your iPad Serial Number
    http://www.ipadastic.com/tutorials/how-to-find-your-ipad-serial-number
    iOS: How to find the serial number, IMEI, MEID, CDN, and ICCID number
    http://support.apple.com/kb/HT4061
     Cheers, Tom

  • How to count number of vehicles using image processing tools in LabVIEW

    anyone can give me idea that how to do counting of vehicles using image processing tools

    Hello,
    if camera is stationary, first take an image of the background. Then subtract each acquired image from the reference image. Limit the region of interest - build a mask of the area, where you want to detect vehicles. Use only the pixels that are under the mask for further processing. You probably would need to do some morphological operations (for example dilate) to make the detection more noise-free...
    Maybe you could get more reference images (different time of day) and compare the average intensities of the acquired and the reference image to select the best image for subtraction.
    You could then probably just count the numer of objects to get the number of vehicles.
    You can perhaps also use optical flow to track the vehicles, but you would need to compute some features for example strong corners for each vehicle (check good features to track, http://docs.opencv.org/modules/imgproc/doc/feature_detection.html). Or you can use the new mean-shift tracking library (Labview 2013).
    Hope this helps a bit.
    Best regards,
    K
    https://decibel.ni.com/content/blogs/kl3m3n
    "Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."

  • How to find image centroid & seperation between two images

    How to find image centroid and seperation between the images,
    i have 2 images pixel values as shown in the picture i should calculate the centroid of the image & find the distance of seperation of the image.
    help me how to do this
    I am using LabView 7.1
    thanks
    sk 
    Attachments:
    New Folder.zip ‏736 KB

    I have a center of energy program similar to the one used by IMAQ. I have attached an example using your data. I first found the center of the entire image. Then I split the array in two and found the centers of each half. That gives you the position of the two spots. This program won't work if the spots are too close to each other or are separeted in the other axis.
    Attachments:
    distance between two spots one direction.vi ‏1096 KB
    Center of energy calc.vi ‏40 KB

  • How to find process chain using background job in sm37

    How to find process chain using background job in sm37

    Better is to select the job.
    Select (Define) Step (s) or F6.
    Select the line and Menu Goto>Variant.
    The variant contains the name of the CHAIN and its VARIANT.
    Success
    We faced an old job and via job monitoring we were informed about a cancelled job every 'interval'.
    We noticed that the related chain was deleted but still the job was scheduled each interval again and was cancelled because an event was missing
    We could not find the scheduled job via SM37.
    Via view V_OP, view over tbtco abd tbtcp, we find the related entry.
    We delete these entries via function BP_JOB_DELETE....
    Edited by: Jack Otten on Jul 9, 2010 2:50 PM

  • How to find how many times a t code has been processed by a user

    How to find how many times a t code has been processed by a user I am not able to get the exact number from the ST03 or STAD/STAT transaction. I am requiring the specific number that this T code has been processed completely this many no of times for a specific period.

    You must be more precise with your question.
    How long is the time period which you want to check, few hours or several days or longer? And how many executions do you expect, 100, 10000 or millions?
    The STAD should help you, for the smaller numbers. There is no solution for the larger ones. Don't mix STAD and ST03, ST03 is aggregated STAD information
    and know only how often a transaction was executed in total.
    ST05 is no solution for your problem to much overhead, and yoou should trace only a short period.
    There is no tool to check usage of transactions in more detail because of privacy reasons.
    Siegfried

  • How to find out the image size?

    How to find out the image size values(Width and height) in illustrator CS3 using any script. I tried but i got only the document height and width. I need to find out the image BoundingBox value of width and height. Kindly advice me.

    Try this.
    tell application "Adobe Illustrator"
    set heightImage to get height of raster item 1 of current layer of current document
    set widthImage to get width of raster item 1 of current layer of current document
    display dialog (heightImage & " X " & widthImage) as string
    end tell
    JaiMS

Maybe you are looking for

  • Can anyone Explain about Data conversion for Material master In SAP MM

    Can anyone Explain about Data conversion for Material master, Vendor  In SAP MM Thanks

  • Process order creation

    Hi Experts, I want to create Process Order for the Rebars(FG for steel) 25 mm Rebar is produced from the Billets(Raw mat for Rebar) cast no     No of Billets    Ton(Rebar)    %C   %mn    CEv 1F3233          64            102              .2        .6

  • Helppp Plzzz, My Java work needs to be done by 2mrw, Im new 2 java.

    Hiii, plzzz wud sum1 help!!! i need 2 hand in my ork 2mrw n ive benng and trying to do tisbut i cant. i dont know anything about java so if someone could plzzz paste all the souce code here, would be soooo grateful. I need to produce a time clock cal

  • Report Links In EPM

    Hi All, The report links in EPM and the webi report in EPM give lot of errors.It never worked smoothly for me. Error like "report does't contain any report". what could be the permanant fix to this error. Now i edit the reports which are throughing e

  • Unicode strings support

    Anyone else have problems with unicode strings with ADFm? I found very strange behavior (bug?) with unicode strings passed through ADFm bindings to EJB method parameters. The method is invoked only once when non-unicode (plain ASCII) characters invol