C++ :: Load PNG Files And Extract RGB Pixels?
Apr 18, 2014How to load png files and extract their rgb pixels? Library recomendations?
View 2 RepliesHow to load png files and extract their rgb pixels? Library recomendations?
View 2 RepliesIts to extract some images from .adf files, I have had it working about 2 years ago but now i cant figure out the right directory.
Code:
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
namespace ADFReader{
class Program {
public static int ApplyOffset(int data, int offset)
[Code] ...
The main problem is
Code:
static void Main(string[] args) {
foreach (string file in Directory.GetFiles(@"data", "*.adf")) ;
{
byte[] bytes = File.ReadAllBytes(file);
[Code] .....
How to load .wav files. Say there are several .wav files in a folder called "sounds" in "My Documents", what would be the steps on loading them in a vector or array. I'm thinking I should use a vector type of array to not worry for a fixed size.
View 3 Replies View RelatedI have a buffer which has a virtual width of 1024 pixels with virtual height 768 pixels (actual width stored in GPU.GPU_screenxsize, height in GPU.GPU_screenysize (both uint_32)).
I currently use the following function to plot the pixels to the screen:
inline void GPU_defaultRenderer() //Default renderer {
uint_32 pixel;
int bufferx; //Buffer's x!
int buffery; //Buffer's y!
int bufferxstart; //Buffer's x start!
int bufferystart; //Buffer's y start!
int pspx;
[Code] ...
How to combine the pixels together (blend them into one goal pixel) to get a better view? (Currently it takes the bottom right pixel of the area that represents the goal pixel).
So (x1,y1,x2,y2)->(pspx,pspy) = (bufferystart,bufferxstart,buffery,bufferx)->(pspx,pspy).
Atm this is (x2,y2)->(pspx,pspy)
Btw the pixel format is uint_32 RGBA (only RGB used atm). The psp_graphics_putpixel draws it onto the real VRAM. PSP_SCREEN_ROWS and PSP_SCREEN_COLUMNS represent the destination screen (the real screen)'s height and width in pixels.
I have a project which opens an image in PictureBox1, no problem. But the Public Static Color method at the bottom of the code is not working. I was hoping it would display the average value of the pixels in the image. why it is not working?
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing.Imaging;
using System.Drawing;
[Code]...
I need to be able to take a bitmap e.g. "untitled.bmp" (bit depth: 24) and loop through every pixel from top left to bottom right and find the rgb (or hex) value for each pixel e.g. (255,255,255) for white and store this rgb (or hex) value in a two-dimensional array depending on its [column]and[row].
How to read bitmap data in in c++ . Also, I'm reluctant to use windows header files as I'd prefer it to be cross-platform.
How to read pixels from an x,y coordinate using the VGA register values?
byte readVRAMdirect(VGA_Type *VGA, uint_32 start, uint_32 offset) //Used in 256 color mode!
{
if (!VGA->VRAM_size) return 0; //No size!
return VGA->VRAM[SAFEMOD((start*4)+offset,VGA->VRAM_size)]; //The full protected offset!
[code]....
getVRAMScanlineStart(VGA,y) gives the offset register multiplied by 2 (shl 1), multiplied with the current memory address size (byte, word or dword) multiplied by the scanline. 256-color mode is already working. GETBIT gives a bit #(0-7) of a specified byte.
writeVRAMplane & readVRAMplane are used by the CPU to write data to VRAM (address 0xA000:xxxx-0xBFFF:xxxx), determined by the memory read and write modes(working) and the odd/even, planar or chain4 enable mode (working).how to get the 16 color and interleaved shift mode working?
ZIP with screen captures: URL....
tell me where the errors in the below code are?
Extra info:
getrowsize() gives the size of a row in bytes (see VGA CRTC register).
getVRAMMemAddrSize() gives the size of a pixel in memory (1=byte,2=word,4=dword)
set/getBitPlaneBit(startaddr,plane,offset,bit[,on when writing]) sets/gets a bit on a specific bit plane offset (start addr is the start address register from VGA,
plane is the plane to read/write,
offset is the offset within the plane,
bit is the bit to read/write (0-7),
[on(when writing) is the value of the bit)]
[code]....
im making a menu system to change the color of pixels in a gravity engine i made. the engine works fine, and the menu colors the particles, but will only ever turn them to red, no matter what color i tell it to change it to.
bool running = true;
bool colorChosen = false;
Uint32 particleColor;
Uint32 randomColor;
[Code]....
I managed to read txt files and printing them on the console window. I was given a task to select and sample a certain amount of data.
Example of txt file:
Voltage (V),Current (I),Power (W)
50,2,100,
51,2,102,
52,2,104,
etc.. How can I display only the column of Voltage and Power?
I need to use the output of my IF statement in a calculation. But how can i extract the output from the IF statement in my code?
#include <iostream>
#include <cmath>
using namespace std;
int main(int argc, char *argv[]) {
double x, y, z;
cout<<"Please enter the student's three test grades:"<<endl;
cin>>x>>y>>z;
[Code]...
I need to use the output in my average.
I have a std::vector<int> and I want to modify subset of the elements. I thought I might be able to use:
std::vector<int> a = { 1,2,3,4,5,6,7,8,9 };
std::vector<int> b(&a[3],&a[7]);
for(auto& each : b) {
each++;
}
for(auto& each : a) {
std::cout << each << "
";
}
but that didn't work. The elements of 'a' retain their original values. Then, I thought, "Ooo, maybe I could make 'b' a reference." Nope. What approach would be to access a subset of a vector for potential alteration?
I need to extract comments from a C file, which are usually marked with " /* This is a comment */ ". It seems to me that I need to calculate first at what position is the / and then ask it if on the very next position to the / operand is the *, if it is then I need check where is the next * and if / operand is immediately next to it. At last I need to take everything between values that the first and second * have. But I don't know how to write that in code.
This was supposed to be done in c++.
im trying to extract this
1 2 3 4
5 7 8
9 6 10 11
13 14 15 12
into a vector where the blank space can variate and the numbers can switch.How can i get this working?
I have a list of files stored in a .txt file
$codeguruc++display.txt$15$
Directory File Folder: codeguruc++
File Name: display.txt
File Size: 15kbs
$ is an delimiter
I want to extract the name and the extension from txt files.
Code:
#include <iostream>
#include <fstream>
#include <cstdlib>
struct MyFile {
std::string Directory;
std::string Filename;
unsigned filesize;
[code].....
Suppose I have read a line from an ASCII file with fgets(). Now I want to parse the line, which looks something like this: Code: # John Q. Public et al. 2014, to be submitted The name, "John Q. Public" is what I want. However, the name can be anything, consisting of 1 or more tokens separated by spaces. it could be "John" Or "John Public", or "Thurston Howell the 3rd", or etc... Bascially, I need to get the entire substring between the first hash mark, and the "et al" in the line. I tried this: Code: sscanf(line,"# %s et al.",name); But I can only get the first token (which, in this case, is "John").
View 2 Replies View Relatedhow to extract certain cells for an excel file that is continuously updating. I had a look at [URL] since they provide a .h library that is useful for this situation, but could not find any code.
View 7 Replies View RelatedLet's say I create a small program or just want to open any kind of file on my computer, but I want to run a program that forces the user to enter a password or something (I already know this part). How does one create the code that would open the file?
View 5 Replies View RelatedI have a stored procedure, which I cannot change (it is used by older programs). It is passed an int of 15 and then an ID is generated and written to a database table. The created ID is then suppose to be selected and returned.
The INSERT does not seem to be working. I'm not getting the created ID value from my code, I am getting the value I passed to the procedure when I get to this
line of code "sessionID = sessionProcedureID.Value.ToString()";.
Below the stored procedure and my code.
/***************Stored Procedure***********************/
USE [testDataBase]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[MakeValue]
[Code] .....
I need to develop a simple program, i have 2 variables (begin, end), and i need to search in a file, And extract the string between the Begin and the End variables to a new File, For Example:
my text file: file.txt:
some text here<StartHere>more text here</EndHere>text text
C++ Program:
//Declear 2 variables
strcpy_s(begin, string("<StartHere>").c_str());
strcpy_s(end, string("</EndHere>").c_str());
//And now, search in the Text file, And Extract the text between the begin string and the End string.
<...>
The Result should be: NewFile.txt with the content:
<StartHere>more text here</EndHere>
That's it!, Here is what i have for now:
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
int main() {
int ocurrences_count = 0;
int ocurrences2_count = 0;
char word[20]; //this array will save user input
[Code] ....
i need to search for a keyword in a binary(.raw)file and have to extract the characters(until a '&' character is found)that immediately following the keyword .
View 1 Replies View RelatedIs there a way I can extract Machine / Hardware ID and OS Version using VC++?
View 3 Replies View RelatedI have an array matrix called tmat,,and i know that in every row of tmax there are values which repeat two times...and am writing a code to extract the values WHICH DOES NOT REPEAT into another matrix called tcopy...the codes compiles fine...and it writes nicely to file...but without the desired result...
One last question...how can i get the array tcopy written to file in the form 5x3...and not all the figures in line one after the other? i mean i wish to see the matrix like a matrix on file..not like a list of numbers....
Code:
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
const int R = 5;
const int C = 5;
[Code] ....
I am trying to put my Save and Load function in my game, this is what i have:
Code:
/* Save game */
void GuardarJuego() {
FILE *fsave;
char turno;
fsave=fopen("SAVE.txt", "w");
fputs(*****, fsave);
[Code] .....
My game code is this: [C] GameCode - Pastebin.com
I don't mean how do I load a bmp, I mean how does SDL manage to do this?
View 2 Replies View RelatedI'm trying to load a PNG image to use as texture, but when I compile the sdl window closes. I'm sure the error is in the function of generating the png texture, because when i don´t use this function, the sdl window does not close. So debugging using cout i found that the cout above glTexImage2D function, shows in console, but the cout in below of glTexImage2D does not work. Does not reading this image?
hear is the function
#include "Texture.h"
#include <iostream>
Texture::Texture() {}
[Code].....