writing my own sobel filter convolution - something is wrong


Posted on 16th Feb 2014 07:03 pm by admin

I am trying to keep it very simple, I cant see anything wrong with my logic, could anybody help point me to the right direction?!!


Did you know?Explore Trending and Topic pages for more stories like this.
Code: { int Shorizontal[] = {-1, 0, 1, -2, 0, 2, -1, 0, 1}; int Svertical[] = {1, 2, 1, 0, 0, 0, -1, -2, -1}; for (int x = 0; x < image.dimx(); x++) for (int y = 0; y < image.dimy(); y++) for (int c = 0; c < 3; c++) // loop through colour channels { int counter = 0; float tempH = 0; float tempV = 0; for (int a = -1; a <= 1; a++) for (int b = -1; b <= 1; b++) if (x + a >= 0 && x + a <= image.dimx() && y + b >= 0 && y + b <= image.dimy()) { tempH += image(x + a,y + b,0, c) * Shorizontal[counter]; tempV += image(x + a,y + b,0, c) * Svertical[counter]; counter++; } image(x,y,0,c) = sqrt(pow(tempH,2) + pow(tempV,2)); } }
No comments posted yet

Your Answer:

Login to answer
291 Like 22 Dislike
Previous forums Next forums
Other forums

A little help in c#
i am doing a simple paint program using c# i want to draw with the mouse so i wrote the code of the

php multiple action on submit
I have a form which says:

<form enctype='multipart/form-data' method='post' action='pr

Need help adding a timestamp to my filename/variable
Hello,

I'm kind of stupid when it comes to php and I need a tiny bit of help. I've got a f

very easy question about SQL info
Hello,
I think that I have a very easy question.
I know how to create a form using php SQL and

Get dump of MySQL DB from Live Site
I'm after an easy, but secure way of generating and importing a MySQL dump from a remote server.

Effort Estimation Template for Steady State Support
Hi Everyone,

Is there any SAP provided template/format for system change and enhancements

Comparing two dates
Hi Guys
I have two dates I want to compare. Below is my current implementation. The problem with

MySQL noob question
hi guys

I have a simple mysql table set up, along the lines of

Col 1 - Col 2 - Date_l

iMatch stored value with the current value in a loop
Hello,

I have a MySQL db were I store articles in.

I have a form to fill these article

DATEDIFF Question
First time post, and of course it is a help question.

I am using a WP plug-in to display prev

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash