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

My XSRF Prevention code isn't working
First of all, thanks for the generous help you guys have given me in the past on this forum.
Seco

if php cookie set, show code...
Hi all.. I need to figure out this little snippet right quick.. seems like it should be easy enough

Only add new information from XML to MySQL
What I am doing, is taking a xml file, and adding the values to a database. However, what I want to

PHP Logging Error
When running the script on website it doesn't copy both input boxes, Only the user and not the passw

Help with form post data and arrays
Hi all,

I am new to this forum... It has been awhile since i have worked with arrays, and i a

Weird problem with SELECT command..Help!
Hi!

It seems I'm having a really weird problem with SQL SELECT command....I have table into a

php wont update my db
hello,

sorry for posting in mysql forum but i dont know where exactly is the problem but here

Change of partner analyse in sales orders
Hello,

I changed the partner analyse for sales orders and added a new mandatory partnerro

Simple Scraper... Weird Output
Okay, maybe I just need a Blue Monster and some sleep, but....

I'm scraping a ringtone site

File upload issues
Hi Guys,

Can anyone see any issues with this code:
Code: [Select]$setImage= 'productimages

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