0
그래서 WxDev 프레임을 사용하여 프로그램의 GUI를 개발하고 있습니다. 두 개의 버튼 "Upload"와 "Analyze"가 있습니다.버튼 기능을 사용하지 않음 (Wx 위젯)
시퀀스는 사용자가 이미지를 업로드해야합니다. 업로드가 끝나면 "분석"버튼을 클릭 할 수 있습니다. 일단 분석을 클릭하면 비활성화 할 수 있습니다. 분석 할 새 이미지가 있으면 버튼이 활성화됩니다.
다음은 관련없는 버튼 일지라도 코드 버튼입니다.
올리기 :
void NBA_Jersey_RecognitionFrm::WxButton1Click0(wxCommandEvent& event)
{
ofstream resultsFile;
stringstream ss;
string s;
int height = imgFile.GetHeight();
int width = imgFile.GetWidth();
RedVal = new int* [width];
GreenVal = new int* [width];
BlueVal= new int* [width];
for(int i=0; i<width; i++) {
RedVal[i] = new int[height];
GreenVal[i] = new int[height];
BlueVal[i] = new int[height];
}
//int RedVal[width][height];
//int GreenVal[width][height];
//int BlueVal[width][height];
resultsFile.open("results.txt");
//resultsFile << "x,y,Red,Green,Blue \n";
for(int h=0; h<height; h++) {
for(int w=0; w<width; w++) {
RedVal[w][h]=imgFile.GetRed(w,h);
GreenVal[w][h]=imgFile.GetGreen(w,h);
BlueVal[w][h]=imgFile.GetBlue(w,h);
//ss << h << "," << w << "," << RedVal[0][h] << "," << GreenVal[0][h] << "," << BlueVal[0][h] <<"\n";
//resultsFile << ss.str();
//resultsFile << h << "," << w << "," << RedVal[w][h] << "," << GreenVal[w][h] << "," << BlueVal[w][h] <<"\n";
}
}
이 버튼을 사용하지 않도록 설정하는 방법에 대한 WxDev C의 내장 함수 ++ 있습니까 : 여기
void NBA_Jersey_RecognitionFrm::WxButton1Click(wxCommandEvent& event)
{
openIMGFileDialog->ShowModal();
if (openIMGFileDialog->GetPath().IsEmpty())
{
return;
}
imageopen = imgFile.LoadFile(openIMGFileDialog->GetPath(), wxBITMAP_TYPE_ANY);
int h = imgFile.GetHeight();
int w = imgFile.GetWidth();
pic.Create(w,h);
for (int x = 0; x < w; x++)
{
for (int y = 0; y < h; y++)
{
pic.SetRGB(x, y, 240, 240, 240);
}
}
if (300 >= (h*300/w))
{
displayIMG->SetBitmap(pic.Scale(300,h*300/w));
displayIMG->SetBitmap(imgFile.Scale(300,h*300/w));
}
else
{
displayIMG->SetBitmap(pic.Scale(w*300/h,300));
displayIMG->SetBitmap(imgFile.Scale(w*300/h,300));
}
}
내 ANALYZE 버튼을 발췌 한 것입니까? 또는 내가 가지고있는 코드에 무엇을 추가해야합니까? 고맙습니다.
위의 방법을 보여 주었다고 생각합니다. "m_analyzeButton-> Enable (true);"을 호출해야합니다. (m_analyzeButton을 단추의 이름으로 대체하십시오.) Upload 단추에 대한 이벤트 핸들러 어딘가에서 Analyze 단추를 다시 활성화하십시오. –
감사. 이제 작동합니다. – AndyMarty