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

Parse error: syntax error, unexpected $end in
hello,
i receive the error :Parse error: syntax error, unexpected $end in C:xamppxampphtdocsh

Get keys and values from an array
Hellow,

I have an array $Data with keys and values. With a foreach I can display all the valu

PHP/Database issue
My friend is helping me make a database where you go to a certain webpage of my site and the page wi

Question about GD library
I am trying to make an image that shows a random quote from my database.


However I want t

VAT
how should I deal with VAT?

if I have a product that costs £5.00 and VAT @ 17.5% (£0.87

mySQL and PHP search
Hello,
I am trying to code a project and ran into a brick wall with one of my pages. I am pretty

need help with php get
i have a option box that gets filled with dates, but how do i get once the option value has been cli

Array becomes unset by itself?
Hi,

I have a bit of experience with PHP but not extensive. It seems I cannot store any items

How can use this array as a key?
Say I have this array for example:


print_r($array);

Prints:
Code: [Select]Array

Unifying logins of two different scripts
I have two different game scripts which I want to embed on my own site. The problem is I don't want

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