ppm

read PPM file and store it in an array; coded with C

天大地大妈咪最大 提交于 2019-12-17 10:35:17
问题 I need to read a PPM file and store it in an array written in C. Can anybody help me out doing this? Thanks a lot. 回答1: The following code shows how to read, change the pixel colour and write an image in PPM format. I hope it helps. #include<stdio.h> #include<stdlib.h> typedef struct { unsigned char red,green,blue; } PPMPixel; typedef struct { int x, y; PPMPixel *data; } PPMImage; #define CREATOR "RPFELGUEIRAS" #define RGB_COMPONENT_COLOR 255 static PPMImage *readPPM(const char *filename) {

How do I install Encode::HanExtra for ActivePerl?

僤鯓⒐⒋嵵緔 提交于 2019-12-13 20:01:50
问题 I want to enable Encode::HanExtra on Windows XP environment. I can't find the name HanExtra or Encode-HanExtra in PPM GUI. Is there any alias name for it? 回答1: Encode-HanExtra does exist according to this page but there is no Windows build. Some options: Encode::CNMap can convert between many different Chinese encodings (gb2312, big5, utf8, gbk). ActivePerl name is Encode-CNMap. There is an ActivePerl version of Encode::CN::Utility which can convert characters between Hanzi, GBK and Unicode

How can I properly install Win32::GuiTest?

扶醉桌前 提交于 2019-12-13 09:23:38
问题 I am trying to use Win32::GuiTest and with Windows XP and perl version 5.8.6. I am getting the following error: Can't locate loadable object for module Win32::GuiTest in @INC (@INC contains: C:/Perl/lib C:/Perl/site/lib .) at E:\a\simply.pl line 259 Compilation failed in require at E:\a\simply.pl line 259. BEGIN failed--compilation aborted at E:\a\simply.pl line 259 I tried following the instructions for Win32-GuiTest-1.3. I tried to install: I created C:\TEMP and I downloaded the zip file

R package spatstat: How to use point process model covariate as factor when pixel image values are numeric

删除回忆录丶 提交于 2019-12-13 06:57:17
问题 I am trying to model a point process with an image covariate using the ppm() function in the spatstat package in R. I convert my raster to an im object for use with spatstat, and I run into a problem using the im as a covariate in the model. The pixel values are numeric, but these are actually just codes for different landscape zones so the crux of the problem is getting the model to read the pixel values as factor rather than numeric. I have tried the following two approaches (R code and

Still nmake problem with Unicode-Map-0.112 after trying vcvarsall.bat [duplicate]

…衆ロ難τιáo~ 提交于 2019-12-13 04:13:59
问题 This question already has answers here : How do I use MS C++ Express 2008 to build Perl Unicode::Map on Windows? (2 answers) Closed 3 years ago . Many thanks to ephemient for recommending to try vcvarsall.bat. In DOS successfully ran vcvarsall.bat, which was part of MS C++ Express 2008 Next I continued to try to follow the PerlMonks advice by using ppm, i.e. http://www.perlmonks.org/?node_id=434813 So I tried to make, really nmake Unicode-Map-0.112 again. I received one more issue: C:\perl

Using fscanf in binary mode

会有一股神秘感。 提交于 2019-12-12 04:52:49
问题 Is using fscanf when opening a file in binary mode bad? I can't seem to find anything reasonable on the Internet. I am trying to open and read a PPM file and I've found this, but I am not sure if using fscanf is okay? And using netpbm is not okay, yeah. Reading this with fread seems like a pain. 回答1: The scanf and fscanf functions are for reading characters, e.g., "1234", and converting them from a string to an integer. But integers are not stored as stings in a binary file. The actual bytes

Convert VERY large ppm files to JPEG/JPG/PNG?

为君一笑 提交于 2019-12-12 02:54:30
问题 So I wrote a C++ program that produces very high resolution pictures (fractals). I use fstream to save all the data in a .ppm file. Everything works fine, but when I go into really high resolution (38400x21600) the ppm file has ~8 Gigabytes. With my 16 Gigabytes of Ram, however, I am still not able to convert that picture. I downloaded couple of converters, but they couldn't handle it. Even Gimp crashed when I try to "export as...". So, does anyone know a good converter that can handle really

OpenGl texturing … ppm background

旧时模样 提交于 2019-12-12 02:35:22
问题 i am using a ppm loader to set image as a background , but there is a problem in colors here is the code and the image that i am use . http://imgur.com/w732d6j http://imgur.com/mJr26Ik here is the code ..... texture.h #ifndef TEXTURE_H #define TEXTURE_H struct Image { unsigned char* pixels; int width; int height; int numChannels; }; class Texture { public: Texture (); void Prepare (int texN); void ReadPPMImage (char *fn); GLuint texName; Image image; }; #endif texture.cpp #include <fstream>

Read PPM files RGB values C++

谁都会走 提交于 2019-12-12 00:34:33
问题 I'm trying read from a PPM file. I want to read the first, second and third number from each row, in this file, but I don´t know how to read the lines. This is what I have so far: for (int y = 4; y <= HEIGHT; y++) { // i think it has to start on row 4 for (int x = 1; x <= WIDTH; x++) { // and x from 1 int i = 4; int r = CurrentR(i); int g = CurrentG(i); int b = CurrentB(i); i++; } } int CurrentR(int I) { return // the first number in row xy } int CurrentG(int I) { return // the second number

Reading input from a file in python 3.x

一世执手 提交于 2019-12-11 21:16:58
问题 Say you are reading input from a file structured like so P3 400 200 255 255 255 255 255 0 0 255 0 0 etc... But you want to account for any mistakes that may come from the input file as in P3 400 200 255 255 255 255 255 0 0 255 0 0 etc... I want to read in the first token 'P3' then the next two '400' '200' (height/width) the '255' and from here on, I want to read every token in and account for how they should be in groups of 3. I have the correct code to read this information but I can't seem