2 Replies - 1678 Views - Last Post: 29 October 2006 - 05:01 AM Rate Topic: -----

#1 Leite33  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 21-July 06

Get Pixel from Image from center

Posted 28 October 2006 - 10:48 PM

Hi
I used a method to get values pixels from a picture and put it in a array.

for(i=0;i<x1;i++)
for(j=0;j<y1;j++)
{
Pic1[(x1*i)+j]=Image1->Canvas->Pixels[i][j];
}


The problem is , with that method i get values from the begining of pic (Pixels[0][0]). I want to start from the center of pic and go up and right..
Any code ideas???

x1 and y1 are height and width of pic.

Is This A Good Question/Topic? 0
  • +

Replies To: Get Pixel from Image from center

#2 gregoryH  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 60
  • View blog
  • Posts: 656
  • Joined: 04-October 06

Re: Get Pixel from Image from center

Posted 29 October 2006 - 01:26 AM

View PostLeite33, on 28 Oct, 2006 - 10:48 PM, said:

Hi
I used a method to get values pixels from a picture and put it in a array.

for(i=0;i<x1;i++)
for(j=0;j<y1;j++)
{
Pic1[(x1*i)+j]=Image1->Canvas->Pixels[i][j];
}
The problem is , with that method i get values from the begining of pic (Pixels[0][0]). I want to start from the center of pic and go up and right..
Any code ideas???

x1 and y1 are height and width of pic.

If i have read you correclty.. you want to start in the middle and go diagonally to the right?

if so.. your start point must be 1/2 of the width and 1/2 of the height...

to go diagonally right... you must decrease the height ( to move towards the top) and increase the width.. the proporations are dependent on X1 and Y1...
Was This Post Helpful? 0
  • +
  • -

#3 William_Wilson  Icon User is offline

  • lost in compilation
  • member icon

Reputation: 205
  • View blog
  • Posts: 4,807
  • Joined: 23-December 05

Re: Get Pixel from Image from center

Posted 29 October 2006 - 05:01 AM

simply put, don't start your for loops at 0:

for(i=(x1/2);i<x1;i++)
for(j=(y1/2);j<y1;j++)


This post has been edited by William_Wilson: 29 October 2006 - 05:02 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1