TADS IFGoiano-Urutaí
Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.
Procurar
 
 

Resultados por:
 


Rechercher Pesquisa avançada

Últimos assuntos
» Principais IDEs para Java
 Operações com matrizes openCv EmptyOntem à(s) 9:27 pm por juk

» LINKS PARA BAIXAR O OFFICE
 Operações com matrizes openCv EmptyTer Abr 23, 2024 5:57 pm por juk

» Backup FULL FIREFOX
 Operações com matrizes openCv EmptyDom Abr 07, 2024 3:16 pm por juk

» Backup FULL CHROME
 Operações com matrizes openCv EmptyDom Abr 07, 2024 2:59 pm por juk

» Dowloand de Videos youtube Sem Permissão adminstrador
 Operações com matrizes openCv EmptySeg Jan 02, 2023 2:13 pm por juk

» Cypecad 2019
 Operações com matrizes openCv EmptySeg Jan 02, 2023 1:41 pm por juk

» Atualizando é instalando o IExplorer 11 no windows 7
 Operações com matrizes openCv EmptyTer Ago 30, 2022 10:54 pm por juk

» COMO HABILITAR INTERNET EXPLORER NO WINDOWS 10
 Operações com matrizes openCv EmptySex Abr 29, 2022 6:43 pm por juk

» Usando o Monitor de Recursos do sistema para identificar processos Associados.
 Operações com matrizes openCv EmptyQua Abr 06, 2022 10:19 am por juk

Quem está conectado?
2 usuários online :: 0 registrados, 0 invisíveis e 2 visitantes

Nenhum

[ Ver toda a lista ]


O recorde de usuários online foi de 192 em Ter Out 26, 2021 6:07 am

Operações com matrizes openCv

Ir para baixo

 Operações com matrizes openCv Empty Operações com matrizes openCv

Mensagem  juk Qui Out 16, 2014 6:51 am

Código:

#include <iostream>
#include "opencv2/opencv.hpp"

using namespace cv;
using namespace std;

void printMatriz(Mat img){
//imprimindo matriz
cout <<"matriz"<<endl;
for(int i =0; i< img.rows; i++){
  cout<<endl;
  for(int j=0; j<img.cols;j++){
      cout<<int(img.at<uchar>(i,j));
                              }
  }
}
void printValor(string titulo, Mat x){
cout << titulo <<endl;
cout << x <<endl;
}
void printInfo(Mat x){

///info
  cout << "img=" << x <<endl <<endl;
  cout << "Tamanho=" << x.size() << endl<<endl;
  cout << "Profunidade=" << x.depth() << endl<<endl;
  cout << "Canais=" << x.channels() << endl<<endl;
  cout << "Tipo=" << x.type() << endl<<endl;
  cout << "Total=" << x.total() << endl<<endl;
  }
void reendMatriz(Mat A){
Mat B(A);
printValor("Matriz A",A);
printValor("Matriz B",B);
B.at<Vec3b>(1,0)=Vec3b(3,2,1);
printValor("Matriz A MODIFICADA",A);
printValor("Matriz B MODIFICADA",B);

}
void roiMATRIZ(Mat img){

}

void layerMatriz(Mat A){
vector<Mat>B(3);
split(A,B); //exploder a matriz em 3 canais
cout << A <<endl<<endl;
cout << B[0] << endl<<endl;
cout << B[1] <<endl <<endl;
cout << B[2] << endl << endl;
}
//reendereçar uma matriz

void layerMerge(Mat A){

vector<Mat>B(3);
split(A,B);
B[1]=B[1]-2;
merge(B,A);
cout <<A << endl << endl;
}
void lixo(){
///fuc
//pegando posic
//int valor = img.at<uchar>(1,1); //matriz 1 canal
//Vec3b valor = img.at<Vec3b>(1,0); //matriz 1 canal
//cout << valor <<endl;
/////alterando valor
http://img.at<Vec3b>(1,0)=Vec3b(3,2,1);
//cout<<img.at<Vec3b>(1,0)<<endl;
}
void converteMatriz(Mat A){
Mat B;
printValor("Matriz A", A);
printValor("Matriz B", B);
A.convertTo(B,CV_32F);
printValor("Matriz A", A/2);
printValor("Matriz B", B/2);
}
int main(int argc, char** argv )
{
  cout << "\t\t\t\t\tTeste"<< endl;

///matriz
  // Mat img= (Mat_<int>(3,3)<<1,1,1,2,2,2,3,3,3);
  Mat img= Mat(3,3,CV_8UC1,Scalar(3));//povoa a matriz
  // Mat img=Mat::ones(3,3,CV_8UC1);//povoa com 1
  //Mat img=Mat::eye(3,3,CV_8UC1);//matriz inversa
 // Mat img=Mat::eye(3,3,CV_8UC3);//matriz inversa 3 canais
 //  Mat img=Mat::zeros(3,3,CV_8UC1);//matriz inversa
converteMatriz(img);
//layerMatriz(img);
//layerMerge(img);
//reendMatriz(img);

  return 0;
}


void layerMatriz(Mat A){
vector<Mat>B(3);
split(A,B); //exploder a matriz em 3 canais
cout << A <<endl<<endl;
cout << B[0] << endl<<endl;
cout << B[1] <<endl <<endl;
cout << B[2] << endl << endl;
}
//reendereçar uma matriz

void layerMerge(Mat A){

vector<Mat>B(3);
split(A,B);
B[1]=B[1]-2;
merge(B,A);
cout <<A << endl << endl;
}
void lixo(){
///fuc
//pegando posic
//int valor = img.at<uchar>(1,1); //matriz 1 canal
//Vec3b valor = img.at<Vec3b>(1,0); //matriz 1 canal
//cout << valor <<endl;
/////alterando valor
http://img.at<Vec3b>(1,0)=Vec3b(3,2,1);
//cout<<img.at<Vec3b>(1,0)<<endl;
}
void converteMatriz(Mat A){
Mat B;
printValor("Matriz A", A);
printValor("Matriz B", B);
A.convertTo(B,CV_32F);
printValor("Matriz A", A/2);
printValor("Matriz B", B/2);
}
int main(int argc, char** argv )
{
  cout << "\t\t\t\t\tTeste"<< endl;

///matriz
  // Mat img= (Mat_<int>(3,3)<<1,1,1,2,2,2,3,3,3);
  Mat img= Mat(3,3,CV_8UC1,Scalar(3));//povoa a matriz
  // Mat img=Mat::ones(3,3,CV_8UC1);//povoa com 1
  //Mat img=Mat::eye(3,3,CV_8UC1);//matriz inversa
 // Mat img=Mat::eye(3,3,CV_8UC3);//matriz inversa 3 canais
 //  Mat img=Mat::zeros(3,3,CV_8UC1);//matriz inversa
converteMatriz(img);
//layerMatriz(img);
//layerMerge(img);
//reendMatriz(img);


  return 0;
}
 Operações com matrizes openCv 9sUWhfH
juk
juk

Mensagens : 266
Data de inscrição : 02/04/2012

Ir para o topo Ir para baixo

Ir para o topo


 
Permissões neste sub-fórum
Não podes responder a tópicos