adjusting converter to work with black and white image backgrounds
This commit is contained in:
parent
965c3f96f9
commit
581e1cd111
@ -11,11 +11,11 @@ class Converter {
|
||||
Converter(std::string level);
|
||||
Converter();
|
||||
~Converter();
|
||||
void updateComposition(unsigned int idG, unsigned int idB, float posX, float posZ);
|
||||
std::vector<unsigned int> newComposition(unsigned int type, float posX, float posZ);
|
||||
void updateComposition(unsigned int idG, unsigned int idB, float posX, float posZ); //updates the position of a composition
|
||||
std::vector<unsigned int> newComposition(unsigned int type, float posX, float posZ);//creates a new composition and returns its ID
|
||||
void deleteComposition(unsigned int idG, unsigned int idB);
|
||||
void save();
|
||||
std::vector<unsigned int> getNextID();
|
||||
void save(); //writes the xml to file
|
||||
std::vector<unsigned int> getNextID(); //returns the next unused ID
|
||||
|
||||
private:
|
||||
std::vector<unsigned int> nextID;
|
||||
|
@ -31,8 +31,8 @@ int main( int argc, char *argv[] ){
|
||||
for(unsigned int columnNum = 0; columnNum < width; columnNum++){
|
||||
unsigned int pixel = (rowNum*width+columnNum)*4;
|
||||
//if there is a composition here, adjust the xml and image
|
||||
if(image[pixel]!=0){
|
||||
if(image[pixel+1]==0 && image[pixel+2]==0){
|
||||
if(image[pixel]!=0 && image[pixel]!=255){
|
||||
if((image[pixel+1]==0 && image[pixel+2]==0) || (image[pixel+1]==255 && image[pixel+2]==255)){
|
||||
std::vector<unsigned int> temp;
|
||||
temp = conv.newComposition(image[pixel], 0.5+rowNum-0.5*height, 0.5+columnNum-0.5*width);
|
||||
idFound[temp[0]][temp[1]] = true;
|
||||
|
Loading…
Reference in New Issue
Block a user