LLIPS
rev33
Light Library for Image ProcesS
Main Page
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
llips
llips_contrastdetect.c
Go to the documentation of this file.
1
/********************************************/
7
/* ***************************************************************/
8
/* Includes */
9
/* ***************************************************************/
10
#include "
llips_includes.h
"
11
12
/* ***************************************************************/
13
/* Global variables */
14
/* ***************************************************************/
15
16
/* ***************************************************************/
17
/* Functions */
18
/* ***************************************************************/
19
20
/********************************************/
34
CPU_CHAR
search_contrast
(
CPU_CHAR
tolerance,
t_img
* img_in1,
t_img
* img_out,
CPU_INT32U
RGB,
CPU_INT32U
color,
CPU_CHAR
direction)
35
{
36
CPU_CHAR
ret =
ERR_NONE
;
37
CPU_INT32S
i,j,limit_he,limit_wi;
38
CPU_INT32U
raw_tolerance;
39
CPU_CHAR
next_i,next_j;
40
41
raw_tolerance = ((
PIXEL_8bit_RANGE
)*tolerance)/100;
42
43
//Write Header
44
for
(i=0;i<img_in1->
FileHeader_size
;i++)
45
{
46
img_out->
FileHeader
[i] = img_in1->
FileHeader
[i];
47
}
48
img_out->
signature
= img_in1->
signature
;
49
img_out->
depth
= img_in1->
depth
;
50
img_out->
wi
= img_in1->
wi
;
51
img_out->
he
= img_in1->
he
;
52
img_out->
FileHeader_size
= img_in1->
FileHeader_size
;
53
54
if
(direction ==
HOR
)
55
{
56
limit_wi = img_in1->
wi
- 1;
57
limit_he = img_in1->
he
;
58
next_i = 0;
59
next_j = 1;
60
}
else
if
(direction ==
VER
)
61
{
62
limit_wi = img_in1->
wi
;
63
limit_he = img_in1->
he
- 1;
64
next_i = 1;
65
next_j = 0;
66
}
else
if
(direction == (
HOR
|
VER
))
67
{
68
limit_wi = img_in1->
wi
- 1;
69
limit_he = img_in1->
he
- 1;
70
next_i = 1;
71
next_j = 1;
72
}
else
73
{
74
limit_wi = 0;
75
limit_he = 0;
76
next_i = 0;
77
next_j = 0;
78
}
79
80
for
(i=0;i< (limit_he ) ;i++)
81
{
82
for
(j=0 ; (j< limit_wi );j++)
83
{
84
if
((color &
BLUE
)!=0)
85
{
86
87
img_out->
Blue
[i][j] = abs((
CPU_INT16S
)(img_in1->
Blue
[i][j]) - (
CPU_INT16S
)(img_in1->
Blue
[i+next_i][j+next_j]));
88
if
(img_out->
Blue
[i][j] > raw_tolerance)
89
{
90
ret |=
DIFF_BLUE
;
91
img_out->
Blue
[i][j] =
GetBlue
(RGB);
92
}
else
93
{
94
img_out->
Blue
[i][j] = 0;
95
}
96
}
else
97
{
98
img_out->
Blue
[i][j] = 0;
99
}
100
101
if
((color &
GREEN
)!=0)
102
{
103
104
img_out->
Green
[i][j] = abs((
CPU_INT16S
)(img_in1->
Green
[i][j]) - (
CPU_INT16S
)(img_in1->
Green
[i+next_i][j+next_j]));
105
if
(img_out->
Green
[i][j] > raw_tolerance)
106
{
107
ret |=
DIFF_GREEN
;
108
img_out->
Green
[i][j] =
GetGreen
(RGB);
109
}
else
110
{
111
img_out->
Green
[i][j] = 0;
112
}
113
}
else
114
{
115
img_out->
Green
[i][j] = 0;
116
}
117
118
if
((color &
RED
)!=0)
119
{
120
121
img_out->
Red
[i][j] = abs((
CPU_INT16S
)(img_in1->
Red
[i][j]) - (
CPU_INT16S
)(img_in1->
Red
[i+next_i][j+next_j]));
122
if
(img_out->
Red
[i][j] > raw_tolerance)
123
{
124
ret |=
DIFF_RED
;
125
img_out->
Red
[i][j] =
GetRed
(RGB);
126
}
else
127
{
128
img_out->
Red
[i][j] = 0;
129
}
130
}
else
131
{
132
img_out->
Red
[i][j] = 0;
133
}
134
}
135
136
}
137
return
ret;
138
}
BLUE
#define BLUE
Definition:
llips_general.h:32
GetGreen
#define GetGreen(c)
Definition:
llips_general.h:81
DIFF_RED
#define DIFF_RED
Definition:
llips_general.h:60
s_img::signature
CPU_INT16U signature
Definition:
llips_type.h:35
ERR_NONE
#define ERR_NONE
Definition:
llips_general.h:46
s_img::FileHeader_size
CPU_INT08U FileHeader_size
Definition:
llips_type.h:44
s_img::depth
CPU_INT16U depth
Definition:
llips_type.h:36
VER
#define VER
Definition:
llips_contrastdetect.h:13
search_contrast
CPU_CHAR search_contrast(CPU_CHAR tolerance, t_img *img_in1, t_img *img_out, CPU_INT32U RGB, CPU_INT32U color, CPU_CHAR direction)
Search constrast between two adjacent pixel.
Definition:
llips_contrastdetect.c:34
DIFF_GREEN
#define DIFF_GREEN
Definition:
llips_general.h:59
llips_includes.h
Global include file for LLIPS.
s_img::wi
CPU_INT32U wi
Definition:
llips_type.h:37
RED
#define RED
Definition:
llips_general.h:34
CPU_CHAR
unsigned char CPU_CHAR
Definition:
llips_type.h:21
GREEN
#define GREEN
Definition:
llips_general.h:33
s_img::Red
CPU_INT08U ** Red
Definition:
llips_type.h:41
s_img
Definition:
llips_type.h:33
CPU_INT16S
signed short CPU_INT16S
Definition:
llips_type.h:26
CPU_INT32U
unsigned long CPU_INT32U
Definition:
llips_type.h:27
s_img::FileHeader
CPU_INT08U FileHeader[MAX_HEADER_size]
Definition:
llips_type.h:43
HOR
#define HOR
Definition:
llips_contrastdetect.h:12
s_img::Blue
CPU_INT08U ** Blue
Definition:
llips_type.h:39
DIFF_BLUE
#define DIFF_BLUE
Definition:
llips_general.h:58
s_img::Green
CPU_INT08U ** Green
Definition:
llips_type.h:40
PIXEL_8bit_RANGE
#define PIXEL_8bit_RANGE
Definition:
llips_general.h:29
GetRed
#define GetRed(c)
Definition:
llips_general.h:82
CPU_INT32S
signed long CPU_INT32S
Definition:
llips_type.h:28
s_img::he
CPU_INT32U he
Definition:
llips_type.h:38
GetBlue
#define GetBlue(c)
Definition:
llips_general.h:80
Generated on Thu Sep 25 2014 14:08:52 for LLIPS by
1.8.8