質問編集履歴
1
width,heightの入れ替え
test
CHANGED
File without changes
|
test
CHANGED
@@ -76,7 +76,7 @@
|
|
76
76
|
|
77
77
|
char *outputfile={"output.ppm"};
|
78
78
|
|
79
|
-
char *inputfile={""};
|
79
|
+
char *inputfile={"peppers.ppm"};
|
80
80
|
|
81
81
|
ColorImage cimage[2];
|
82
82
|
|
@@ -168,9 +168,9 @@
|
|
168
168
|
|
169
169
|
int i,j;
|
170
170
|
|
171
|
-
for(i=0;i<cimage->width;i++){
|
172
|
-
|
173
|
-
|
171
|
+
for(i=0;i<cimage->height;i++){
|
172
|
+
|
173
|
+
for(j=0;j<cimage->width;j++){
|
174
174
|
|
175
175
|
cimage->r[i][j]=255-cimage->r[i][j];
|
176
176
|
|
@@ -192,9 +192,9 @@
|
|
192
192
|
|
193
193
|
int i,j;
|
194
194
|
|
195
|
-
for(i=0;i<cimage->width;i++){
|
196
|
-
|
197
|
-
|
195
|
+
for(i=0;i<cimage->height;i++){
|
196
|
+
|
197
|
+
for(j=0;j<cimage->width;j++){
|
198
198
|
|
199
199
|
cimage->r[i][j]=1.5*cimage->r[i][j]-10;
|
200
200
|
|
@@ -218,9 +218,9 @@
|
|
218
218
|
|
219
219
|
int i,j;
|
220
220
|
|
221
|
-
for(i=0;i<cimage->width;i++){
|
222
|
-
|
223
|
-
|
221
|
+
for(i=0;i<cimage->height;i++){
|
222
|
+
|
223
|
+
for(j=0;j<cimage->width;j++){
|
224
224
|
|
225
225
|
cimage->r[i][j]=powf(cimage->r[i][j],1.4);
|
226
226
|
|
@@ -242,17 +242,17 @@
|
|
242
242
|
|
243
243
|
int i,j;
|
244
244
|
|
245
|
-
for(i=0;i<cimage->width;i++){
|
246
|
-
|
247
|
-
|
245
|
+
for(i=0;i<cimage->height;i++){
|
246
|
+
|
247
|
+
for(j=0;j<cimage->width;j++){
|
248
248
|
|
249
249
|
/*この場合は7ビットにビットシフトを用いて量子化する*/
|
250
250
|
|
251
|
-
cimage->r[i][j]=((int)cimage->r[i][j]>>(8-
|
251
|
+
cimage->r[i][j]=((int)cimage->r[i][j]>>(8-1))<<(8-1);
|
252
|
-
|
252
|
+
|
253
|
-
cimage->g[i][j]=((int)cimage->g[i][j]>>(8-
|
253
|
+
cimage->g[i][j]=((int)cimage->g[i][j]>>(8-1))<<(8-1);
|
254
|
-
|
254
|
+
|
255
|
-
cimage->b[i][j]=((int)cimage->b[i][j]>>(8-
|
255
|
+
cimage->b[i][j]=((int)cimage->b[i][j]>>(8-1))<<(8-1);
|
256
256
|
|
257
257
|
}
|
258
258
|
|
@@ -270,13 +270,21 @@
|
|
270
270
|
|
271
271
|
int i,j;
|
272
272
|
|
273
|
-
int
|
273
|
+
int a,b,c;
|
274
|
-
|
274
|
+
|
275
|
-
|
275
|
+
a=150;
|
276
|
+
|
276
|
-
|
277
|
+
b=150;
|
278
|
+
|
279
|
+
c=150;
|
280
|
+
|
277
|
-
|
281
|
+
for(i=0;i<fg->height;i++){
|
282
|
+
|
278
|
-
|
283
|
+
for(j=0;j<fg->width;j++){
|
284
|
+
|
279
|
-
if(fg->r[i][j]<
|
285
|
+
if(fg->r[i][j]<a && fg->g[i][j]>b && fg->g[i][j]<c)
|
286
|
+
|
287
|
+
{
|
280
288
|
|
281
289
|
fg->r[i][j]=bg->r[i][j];
|
282
290
|
|
@@ -286,6 +294,18 @@
|
|
286
294
|
|
287
295
|
}
|
288
296
|
|
297
|
+
else
|
298
|
+
|
299
|
+
{
|
300
|
+
|
301
|
+
fg->r[i][j]=fg->r[i][j];
|
302
|
+
|
303
|
+
fg->g[i][j]=fg->g[i][j];
|
304
|
+
|
305
|
+
fg->b[i][j]=fg->b[i][j];
|
306
|
+
|
307
|
+
}
|
308
|
+
|
289
309
|
}
|
290
310
|
|
291
311
|
}
|