Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Sobel Edge detectors

Reply
Thread Tools

Sobel Edge detectors

 
 
deepsri.88 deepsri.88 is offline
Junior Member
Join Date: Nov 2010
Posts: 1
 
      11-07-2010
Hi Everyone! I have an jpeg image and do edge detection on this image. I plan to use sobel edge detector to help me. I have
just gotten the JAI API. I realized that they have a Packages.javax.media.jai package with KernelJAI.GRADIENT_MASK_SOBEL_HORIZONTAL and KernelJAI.GRADIENT_MASK_SOBEL_VERTICAL.
I believe that using this will make implementing the edge detection easier.
I have written the code below but I get an error and nothing is outputted.


import java.awt.*;
import java.awt.image.*;
import java.io.*;
import java.util.*;
import java.awt.event.*;
import javax.swing.*;
import javax.imageio.*;
import javax.swing.event.*;
import javax.media.jai.*;
import javax.media.jai.PlanarImage;
import javax.media.jai.JAI;
import java.awt.image.renderable.ParameterBlock;

public class test {


public static void loadImage() {
//Loads the image from the given path and filename
//this.img = (PlanarImage)JAI.create("fileload", "C:/pic/pic2.jpg");
PlanarImage img =(PlanarImage)JAI.create("fileload", "C:/pic/pic2.jpg");
KernelJAI sobelHorizontalKernel = KernelJAI.GRADIENT_MASK_SOBEL_HORIZONTAL;
KernelJAI sobelVerticalKernel = KernelJAI.GRADIENT_MASK_SOBEL_VERTICAL;
ParameterBlock pb = new ParameterBlock();
pb.addSource(img);
pb.add(sobelHorizontalKernel);
pb.add(sobelVerticalKernel);
PlanarImage image = JAI.create("gradientmagnitude",pb, null);
//canvas.set(image);
JAI.create("filestore", image, "edge.jpg", "JPEG");
}



public static void main(String args[])
{
loadImage();



}
}


This keeps giving some error. Not sure on how to solve it. I m a newbie at this and hope someone could help me point out on what I might have done wrong.

Thanks in advance
 
Reply With Quote
 
 
 
Reply

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Lenovo ThinkPad EDGE 13: Bleeding Edge Ian Front Page News 0 02-28-2011 10:18 AM
edge detection using sobel kumar9422 VHDL 0 05-29-2010 10:44 AM
3x3 sobel edge detection dashdingo VHDL 3 09-26-2009 05:57 PM
using both rising edge and falling edge of signal denish VHDL 5 11-17-2008 07:12 PM
Boost.graph - changing edge end-points or copying an edge Ferdi Smit C++ 0 10-10-2005 04:30 PM



Advertisments