Normas del foro

Curso Hacker
Bienvenido(a), Visitante. Favor de ingresar o registrarse.
¿Perdiste tu email de activación? - Noviembre 18, 2008, 02:26:00
Inicio Ayuda Ingresar Registrarse
Visita: Articulos - Juegos Gratis - Da Foros

Comunidad Underground Hispana  |  Programacion  |  Programación  |  Programación Basica  |  Tema: VB E IMAGENES URGENTE :'( 0 Usuarios y 1 Visitante están viendo este tema. « anterior próximo »
Páginas: [1] Ir Abajo Imprimir
Autor Tema: VB E IMAGENES URGENTE :'(  (Leído 398 veces)
EVIDENCE544
Visitante
« en: ſeptiembre 02, 2003, 09:24:20 »

NECESITO CREAR UN PROGRAMA EN VB KE DIGA EL NUMERO DE PIXELES DE UNA IMAGEN (VARIOS FORMATOS .GIF, .JPEG, .BMP) Y ADEMAS MUESTRE EN UNA GRAFICA LA FRECUENCIA DE COLORES KE SE UTILIZAN Y UNA COPIA CASI EXACTA DE PAINT
ESPERO KE ALGUIEN PUEDA AYUDARME
 GRACIAS Smiley
En línea
insinificante
Visitante


Email
« Respuesta #1 en: ſeptiembre 04, 2003, 01:11:13 »

Te he conseguido 2 ejemplos que tal vez te ayuden, el primero esta creado en Visual Basic NET si hablas de VB 6 mas abajo hay uno.  


Necesitas ser usuario para ver los enlaces Crear Usuario  Hacer Sesion


Necesitas ser usuario para ver los enlaces Crear Usuario  Hacer Sesion
En línea
EVIDENCE544
Visitante
« Respuesta #2 en: ſeptiembre 08, 2003, 07:10:30 »

GRACIAS POR LOS EJEMPLOS

ESTAN BIEN PERO NECESITO ALGO UN POQUITO MAS AVANZADO

DE TODOS MODOS GRACIAS  Grin Grin
En línea
codelogman
Visitante
« Respuesta #3 en: ſeptiembre 12, 2003, 02:43:47 »

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <iostream.h>

#ifndef _bmp_h_


struct dosbyte {
   unsigned char b1;
   unsigned char b2;
};

#define Ilight   140
#define K      70
#define IaKa   0.2
#define Hx      0.325058
#define Hy      0.325058
#define Hz      0.888074
#define dx      110.0
#define dy      110.0
#define dz      110.0
#define Lx      0.57735
#define Ly      0.57735
#define Lz      0.57735

#define word unsigned long
//Estructura del BMP
//El Head del BMP
struct HEAD {
  word bfSize;
  dosbyte bfReserved1;
  dosbyte bfReserved2;
  word bfOffBits;
  word biSize;
  word biWidth;  
  word biHeight;
  dosbyte biPlanes;
  dosbyte biBitCount;
  word biCompression;
  word biSizeImage;
  word biXPelsPerMater;
  word biYPelsPerMater;
  word biClrUsed;
  word biClrIportant;
};

//Color RGB en la imagen
struct Color {
    unsigned char Red;
    unsigned char Green;
    unsigned char Blue;
    Color(unsigned char r,unsigned char g,unsigned char b) {Red=r,Green=g,Blue=b;}
};


class BMP {
 
  public:
    inline BMP(char *Name) {Nombre=Name;}
    inline ~BMP(void) {delete imagen;}
    void writepixel(int Cordenada_x,int Cordenada_y,Color color_p);
    void writehead(unsigned long Dim_x,unsigned long Dim_y);
    int guarda(void);
    int estadopixel(int x,int y);
  private:


   char bfType[2];
    HEAD encabezado;
    unsigned char *imagen;
    char *Nombre;
    unsigned long tem,X,Y;
    FILE *fp;
};

#endif
*************************************************

#include "bmp.h"



void BMP::writehead(unsigned long Dim_x,unsigned long Dim_y) {
  tem=(Dim_x*Dim_y*3);
  encabezado.bfSize=(54+tem);
  encabezado.bfReserved1.b1=encabezado.bfReserved1.b2=0;
  encabezado.bfReserved2.b1=encabezado.bfReserved2.b2=0;
  encabezado.bfOffBits=54;
  encabezado.biSize=40;
  X=encabezado.biWidth=Dim_x;
  Y=encabezado.biHeight=Dim_y;
  encabezado.biPlanes.b1=1,encabezado.biPlanes.b2=0;
  encabezado.biBitCount.b1=24,encabezado.biBitCount.b2=0;
  encabezado.biCompression=0;
  encabezado.biSizeImage=0;
  encabezado.biXPelsPerMater=0;
  encabezado.biYPelsPerMater=0;
  encabezado.biClrUsed=0;
  encabezado.biClrIportant=0;
  imagen=(unsigned char *)malloc(tem);
 
}


void BMP::writepixel(int Cordenada_x,int Cordenada_y,Color color_p) {
  tem=3*(X*Cordenada_x+Cordenada_y);
  imagen[tem]=color_p.Red;
  imagen[tem+1]=color_p.Green;
  imagen[tem+2]=color_p.Blue;
}


int BMP::estadopixel(int x,int y){

   tem=3*(X*x+y);
   float sum=0;
   sum=imagen[tem]+imagen[tem+1]+imagen[tem+2];
   if(sum>0) return 1;
   return 0;
}

int BMP::guarda(void) {
  unsigned long tam=(X*Y*3),w=tam+Y*(3*X%4);
  unsigned char *ima;
  ima=(unsigned char *)malloc(w);    
  bfType[0]='B',bfType[1]='M';
  if((fp=fopen(Nombre,"wb"))==NULL)
    return 0;
  if((fwrite(&bfType,sizeof(char),2,fp))  != 2)
    return 0;
  if((fwrite(&encabezado,sizeof(HEAD),1,fp))  != 1)
    return 0;
  for(unsigned long i=0;i<X;i++) {
    for(unsigned long j=0;j<Y;j++) {
     ima[(Y-1-i)*X*3+j*3+i*(3*X%4)+2]=imagen[(i*Y+j)*3];   //R
      ima[(Y-1-i)*X*3+j*3+i*(3*X%4)+1]=imagen[(i*Y+j)*3+1]; //G
      ima[(Y-1-i)*X*3+j*3+i*(3*X%4)]  =imagen[(i*Y+j)*3+2]; //B
    }
   switch((X*3)%4) {
      case 3:
        ima[(i+1)*X*3]=0;
        break;
      case 2:
        ima[(i+1)*X*3+i*(3*X%4)+1]=ima[(i+1)*X*3+i*(3*X%4)]=0;
        break;
      case 1:
        ima[(i+1)*X*3+i*(3*X%4)+1]=ima[(i+1)*X*3+i*(3*X%4)+2]=
           ima[(i+1)*X*3+i*(3*X%4)]=0;
        break;
     default:
        break;
   }
   
  }
  if((fwrite (ima,sizeof(unsigned char), tam, fp)) != tam)
    return 0;
  return 1;
}


**************************************************

#include "bmp.h"
#include <math.h>
#define t 1000

Color rojo(255,0,0);
Color negro(0,0,0);
Color alguno(0.345,123,125);
Color blanco(255,255,255);

int funcion22(int A,int B,int C){

   return ((!A & !B & C) | (A & !B & !C) | (!A & B & !C));
}



int main(int argv,char **argc) {

   if(argv!=2) {
      cout<<"Use: "<<argc[0] <<" <img1.bmp>\n";
      return 0;
   }

   int  virus[t];
   int virus2[t];
   
   BMP lineas(argc[1]);

   lineas.writehead(t,t);



   for(int i=0;i<t;i++){
      if(i==499 )
         virus=1;
      else
         virus=0;

      virus2=0;
   }

   for(int j=0;j<t;j++){

      for(int i=0;i<t;i++){

         switch(i){
            case 0:
               virus2=funcion22(virus[t-1],virus,virus[i+1]);

               break;
            case 999 :
               virus2=funcion22(virus[i-1],virus,virus[0]);

               break;
            default:
               virus2=funcion22(virus[i-1],virus,virus[i+1]);

               break;
         }
         if(virus)
            lineas.writepixel(j,i,alguno);
         else
            lineas.writepixel(j,i,blanco);

      }

      for(int i=0;i<t;i++) virus=virus2;
   }



   if(!lineas.guarda()){
      cerr << "\nHa ocurrido un grave error en la imagen\n";
      return 0;
   }

   cout << "\nSe ha creado la imagen satisfactoriamente\n";

   return 1;

}


..............si necesitas algo mas avanzado, te lo pongo en assembler, tu escoges (VB apesta, por eso no lo pongo en VB source, aunque .NET esta buenillo)

Az
En línea
Páginas: [1] Ir Arriba Imprimir 
Comunidad Underground Hispana  |  Programacion  |  Programación  |  Programación Basica  |  Tema: VB E IMAGENES URGENTE :'( « anterior próximo »
Ir a:  


Ranking-Hits
Powered by SMF 1.1.7 | SMF © 2006-2007, Simple Machines LLC