Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Visual Basic Help

Status
Not open for further replies.

elec123

New Member
Hi,

I am new to using Visual Basic and am having a few problems, and help would be greatly received:

The data is attached. (lena.xls is the spreadsheet with the data of the image and Book1 is this data viewed in notepad). Also attached is the pciture converted into grey scale.

The digital numbers for this image are contained in the file lena.xls. They are values that potentially range from 0 to 255, with lighter areas of the image having higher values. For example, the white of the right eye is approximately 1/3 of the way across the image and 1/3 of the way down. In this region of the excel file you should see some of the highest values for the digital numbers.

I have extracted the data for the grey scale image and is contained within lena.xls (attached) From this I have put the data into notepad and saved it as a .pgm file which i can then open in paint shop pro to view the image from the data.

The problem on the image is that the edges-because the computer will place the Sobel filter at the appropriate cell and will then look for values to the side, which may be off the edge of the worksheet.

To prevent this I have cloned the edge pixel so the sobel filter includes the edge of the original picture.

I am now having difficulties with these two tasks:

Algorithm
Produce a diagram outlining how your code will work and the steps needed at each stage to perform Sobel edge enhancement.


The code
Write some computer code to perform this operation (this can be done using the methods you have been taught in under 30 lines). Provide the code with your report. You may find it helpful to analyse the image on sheet1 and write the output to sheet2 as in the t-test example, above.

Any help/guidance/suggestions would be great as i'm completely stuck!!

Thanks
 

Attachments

  • lena.xls
    115 KB · Views: 126
  • book1.txt
    60.9 KB · Views: 136
  • lenapic.doc
    730 KB · Views: 178
i see, you already did the hard part... :lol: :lol: :lol:
i guess google didn't help and produce hits of any website like this:
**broken link removed**

Soebel is just a very simple filter:

Code:
The Sobel masks for edge detection
It is possible to combine more than one operation in a single mask. A good example is given by the Sobel masks for edge detection, which combine the vertical and horizontal differencing operations with some smoothing to reduce the effects of noise or very local texture.

The masks look like:

            ----------------        ----------------
            | -1 |  0 |  1 |        | -1 | -2 | -1 |
            |----+----+----|        |----+----+----|
            | -2 |  0 |  2 |        |  0 |  0 |  0 |
            |----+----+----|        |----+----+----|
            | -1 |  0 |  1 |        |  1 |  2 |  1 |
            ----------------        ----------------
The single values used in the simple differencers above are replaced by averages over 3 pixels, weighted towards the centre in each case. In addition, the positive and negative parts are separated by a one-pixel gap; by increasing the baseline for differencing this too has a smoothing effect, and it allows the mask to be more symmetrical, so that the results are "centred" in a way that is not true for the smaller difference operators.

You should now easily be able to set up the Sobel masks and look at their effects. Compare the outputs from the Sobel masks with the results of smoothing the image and then taking vertical or horizontal differences - the results should be similar, though not identical.

30 lines is pushing it (someone must be writing very long comments)
 
hi elec123,

cloning edges sounds ok, you will have to remove them after processing. i would suggest making two arrays to hold data (one with raw data and one with output) and nested loops to process data. both of this should not take more than 1/2 hour to learn from scratch if you have any decent VB book or internet access. VB tutorials are everywhere. you can try www.programmersheaven.com for example. you might find something interesting in their download section too.
 
Status
Not open for further replies.

Latest threads

Back
Top