Use 0-255 range for pgm output
This commit is contained in:
parent
850a5d22a9
commit
50dfa98f51
1 changed files with 2 additions and 2 deletions
|
@ -207,12 +207,12 @@ namespace internal {
|
||||||
|
|
||||||
printf("Writing to %s, min is %.3f, max is %.3f\n", filename, filter[min], filter[max]);
|
printf("Writing to %s, min is %.3f, max is %.3f\n", filename, filter[min], filter[max]);
|
||||||
FILE *filter_image = fopen(filename, "w");
|
FILE *filter_image = fopen(filename, "w");
|
||||||
fprintf(filter_image, "P2\n%d %d\n65535\n", width, (int)filter.size() / width);
|
fprintf(filter_image, "P2\n%d %d\n255\n", width, (int)filter.size() / width);
|
||||||
for(std::vector<float>::size_type i = 0; i < filter.size(); ++i) {
|
for(std::vector<float>::size_type i = 0; i < filter.size(); ++i) {
|
||||||
fprintf(filter_image, "%d ",
|
fprintf(filter_image, "%d ",
|
||||||
(int)(((filter[i] - filter[min])
|
(int)(((filter[i] - filter[min])
|
||||||
/ (filter[max] - filter[min]))
|
/ (filter[max] - filter[min]))
|
||||||
* 65535.0f));
|
* 255.0f));
|
||||||
if((i + 1) % width == 0) {
|
if((i + 1) % width == 0) {
|
||||||
fputc('\n', filter_image);
|
fputc('\n', filter_image);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue