1
0

Start create python version.

This commit is contained in:
Jarosław Wieczorek 2021-03-08 11:51:01 +01:00
parent 3fe380fd3c
commit 55d0a6d4a9
189 changed files with 42688 additions and 500 deletions

3
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

6
.idea/encodings.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/cpp/skeletonApp/skeletonApp/skeletonApp.cpp" charset="UTF-8" />
</component>
</project>

View File

@ -0,0 +1,48 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyArgumentEqualDefaultInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PyAugmentAssignmentInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PyClassicStyleClassInspection" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="PyCompatibilityInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ourVersions">
<value>
<list size="5">
<item index="0" class="java.lang.String" itemvalue="3.7" />
<item index="1" class="java.lang.String" itemvalue="3.8" />
<item index="2" class="java.lang.String" itemvalue="3.9" />
<item index="3" class="java.lang.String" itemvalue="3.10" />
<item index="4" class="java.lang.String" itemvalue="3.10" />
</list>
</value>
</option>
</inspection_tool>
<inspection_tool class="PyMandatoryEncodingInspection" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="PyMissingOrEmptyDocstringInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PyMissingTypeHintsInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredPackages">
<value>
<list size="1">
<item index="0" class="java.lang.String" itemvalue="argparse" />
</list>
</value>
</option>
</inspection_tool>
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="ignoredErrors">
<list>
<option value="N802" />
<option value="N803" />
</list>
</option>
</inspection_tool>
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredIdentifiers">
<list>
<option value="anc.models.samples.Sample._meta" />
</list>
</option>
</inspection_tool>
</profile>
</component>

View File

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="jdk" jdkName="Python 3.9 (lpo-image-processing)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

7
.idea/misc.xml Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (lpo-image-processing)" project-jdk-type="Python SDK" />
<component name="PythonCompatibilityInspectionAdvertiser">
<option name="version" value="3" />
</component>
</project>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/lpo-image-processing.iml" filepath="$PROJECT_DIR$/.idea/lpo-image-processing.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="en_150"></TS>

View File

@ -1,484 +1,483 @@
#include <QToolBar> #include <QToolBar>
#include <QIcon> #include <QIcon>
#include <QClipboard> #include <QClipboard>
#include <QColorSpace> #include <QColorSpace>
#include <QDir> #include <QDir>
#include <QFileDialog> #include <QFileDialog>
#include <QImageReader> #include <QImageReader>
#include <QImageWriter> #include <QImageWriter>
#include <QBuffer> #include <QBuffer>
#include <QLabel> #include <QLabel>
#include <QMenuBar> #include <QMenuBar>
#include <QMessageBox> #include <QMessageBox>
#include <QMimeData> #include <QMimeData>
#include <QPainter> #include <QPainter>
#include <QScreen> #include <QScreen>
#include <QScrollArea> #include <QScrollArea>
#include <QScrollBar> #include <QScrollBar>
#include <QStandardPaths> #include <QStandardPaths>
#include <QStatusBar> #include <QStatusBar>
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include "skeletonApp.h" #include "skeletonApp.h"
skeletonApp::skeletonApp(QWidget *parent) skeletonApp::skeletonApp(QWidget *parent): QMainWindow(parent),
: QMainWindow(parent), imageLabel(new QLabel) imageLabel(new QLabel), scrollArea(new QScrollArea)
, scrollArea(new QScrollArea) {
{ ui.setupUi(this);
ui.setupUi(this);
imageLabel->setBackgroundRole(QPalette::Base);
imageLabel->setBackgroundRole(QPalette::Base); imageLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
imageLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); imageLabel->setScaledContents(true);
imageLabel->setScaledContents(true);
scrollArea->setBackgroundRole(QPalette::Dark);
scrollArea->setBackgroundRole(QPalette::Dark); scrollArea->setWidget(imageLabel);
scrollArea->setWidget(imageLabel); scrollArea->setVisible(false);
scrollArea->setVisible(false); setCentralWidget(scrollArea);
setCentralWidget(scrollArea);
createActions();
createActions();
resize(QGuiApplication::primaryScreen()->availableSize() * 3 / 5);
resize(QGuiApplication::primaryScreen()->availableSize() * 3 / 5);
}
}
bool skeletonApp::loadFile(const QString& fileName)
bool skeletonApp::loadFile(const QString& fileName) {
{
data.clear();
data.clear();
QImageReader reader(fileName);
QImageReader reader(fileName); reader.setAutoTransform(true);
reader.setAutoTransform(true); const QImage newImage = reader.read();
const QImage newImage = reader.read(); if (newImage.isNull()) {
if (newImage.isNull()) { QMessageBox::information(this, QGuiApplication::applicationDisplayName(),
QMessageBox::information(this, QGuiApplication::applicationDisplayName(), tr("Cannot load %1: %2")
tr("Cannot load %1: %2") .arg(QDir::toNativeSeparators(fileName), reader.errorString()));
.arg(QDir::toNativeSeparators(fileName), reader.errorString())); return false;
return false; }
}
//testFilter->setEnabled(true);
//testFilter->setEnabled(true); filtersMenu->setDisabled(false);
filtersMenu->setDisabled(false);
setImage(newImage);
setImage(newImage);
width = image.width();
width = image.width(); height = image.height();
height = image.height(); int bitPlanes = image.bitPlaneCount();
int bitPlanes = image.bitPlaneCount(); int depth = image.depth();
int depth = image.depth(); QImage::Format format = image.format();
QImage::Format format = image.format(); int bytesPerLine = image.bytesPerLine();//niezale<6C>nie od formatu( pbm, pgm, ppm), wyr<79>wnanie do 4B
int bytesPerLine = image.bytesPerLine();//niezale¿nie od formatu( pbm, pgm, ppm), wyrównanie do 4B
nbChannels = 1;
nbChannels = 1; if (image.depth() > 1)
if (image.depth() > 1) nbChannels = image.depth() / 8;
nbChannels = image.depth() / 8;
nbRealChannels = 1;
nbRealChannels = 1; if (image.bitPlaneCount() > 1)
if (image.bitPlaneCount() > 1) nbRealChannels = image.bitPlaneCount() / 8;
nbRealChannels = image.bitPlaneCount() / 8;
std::ofstream file("test_zapisu.txt", std::ios::out);
std::ofstream file("test_zapisu.txt", std::ios::out);
if (file.good())
if (file.good()) {
{
for (int i = 0; i < image.height(); i++)
for (int i = 0; i < image.height(); i++) {
{ std::vector<std::vector<int>> row;
std::vector<std::vector<int>> row;
for (int j = 0; j < image.width(); j++)
for (int j = 0; j < image.width(); j++) {
{ QRgb impix = image.pixel(j, i);//pixel() dzia<69>a w logice pixel(x,y) - najpierw specyfikuje kolumn<6D>
QRgb impix = image.pixel(j, i);//pixel() dzia³a w logice pixel(x,y) - najpierw specyfikuje kolumnê
std::vector<int> pixel;
std::vector<int> pixel;
switch (nbChannels)
switch (nbChannels) {
{ case 1:
case 1: pixel = { qRed(impix) };
pixel = { qRed(impix) }; file << pixel[0] << " ";
file << pixel[0] << " "; break;
break; case 3:
case 3: pixel = { qRed(impix), qGreen(impix), (int)qBlue(impix) };
pixel = { qRed(impix), qGreen(impix), (int)qBlue(impix) }; file << pixel[0] << " " << pixel[1] << " " << pixel[2];
file << pixel[0] << " " << pixel[1] << " " << pixel[2]; break;
break; case 4:
case 4: pixel = { qRed(impix), qGreen(impix), qBlue(impix), qAlpha(impix) };
pixel = { qRed(impix), qGreen(impix), qBlue(impix), qAlpha(impix) }; file << pixel[0] << " " << pixel[1] << " " << pixel[2] << " " << pixel[3];
file << pixel[0] << " " << pixel[1] << " " << pixel[2] << " " << pixel[3]; break;
break; }
} file << "\n";
file << "\n"; row.push_back(pixel);
row.push_back(pixel); }
} // file << "\n";
// file << "\n"; data.push_back(row);
data.push_back(row); //std::cout << "\n";
//std::cout << "\n"; }
}
file.close();
file.close(); }
} setWindowFilePath(fileName);
setWindowFilePath(fileName);
const QString message = tr("Opened \"%1\", %2x%3, Depth: %4, Bit planes: %5")
const QString message = tr("Opened \"%1\", %2x%3, Depth: %4, Bit planes: %5") .arg(QDir::toNativeSeparators(fileName)).arg(image.width()).arg(image.height()).arg(image.depth()).arg(image.bitPlaneCount());
.arg(QDir::toNativeSeparators(fileName)).arg(image.width()).arg(image.height()).arg(image.depth()).arg(image.bitPlaneCount()); statusBar()->showMessage(message);
statusBar()->showMessage(message); return true;
return true; }
}
void skeletonApp::setImage(const QImage& newImage)
void skeletonApp::setImage(const QImage& newImage) {
{ image = newImage;
image = newImage; if (image.colorSpace().isValid())
if (image.colorSpace().isValid()) image.convertToColorSpace(QColorSpace::SRgb);
image.convertToColorSpace(QColorSpace::SRgb); imageLabel->setPixmap(QPixmap::fromImage(image));
imageLabel->setPixmap(QPixmap::fromImage(image)); scaleFactor = 1.0;
scaleFactor = 1.0;
scrollArea->setVisible(true);
scrollArea->setVisible(true); // printAct->setEnabled(true);
// printAct->setEnabled(true); fitToWindowAct->setEnabled(true);
fitToWindowAct->setEnabled(true); updateActions();
updateActions();
if (!fitToWindowAct->isChecked())
if (!fitToWindowAct->isChecked()) imageLabel->adjustSize();
imageLabel->adjustSize(); }
}
void skeletonApp::scaleImage(double factor)
void skeletonApp::scaleImage(double factor) {
{ scaleFactor *= factor;
scaleFactor *= factor; imageLabel->resize(scaleFactor * imageLabel->pixmap(Qt::ReturnByValue).size());
imageLabel->resize(scaleFactor * imageLabel->pixmap(Qt::ReturnByValue).size());
adjustScrollBar(scrollArea->horizontalScrollBar(), factor);
adjustScrollBar(scrollArea->horizontalScrollBar(), factor); adjustScrollBar(scrollArea->verticalScrollBar(), factor);
adjustScrollBar(scrollArea->verticalScrollBar(), factor);
zoomInAct->setEnabled(scaleFactor < 3.0);
zoomInAct->setEnabled(scaleFactor < 3.0); zoomOutAct->setEnabled(scaleFactor > 0.333);
zoomOutAct->setEnabled(scaleFactor > 0.333); }
}
void skeletonApp::adjustScrollBar(QScrollBar* scrollBar, double factor)
void skeletonApp::adjustScrollBar(QScrollBar* scrollBar, double factor) {
{ scrollBar->setValue(int(factor * scrollBar->value()
scrollBar->setValue(int(factor * scrollBar->value() + ((factor - 1) * scrollBar->pageStep() / 2)));
+ ((factor - 1) * scrollBar->pageStep() / 2))); }
}
void skeletonApp::about()
void skeletonApp::about() {
{ QMessageBox::about(this, tr("About skeletonApp"),
QMessageBox::about(this, tr("About skeletonApp"), tr("<p>Aplikacja<b> szkieletowa</b> do kursu <i>Przetwarzanie obrazu</i></p>"));
tr("<p>Aplikacja<b> szkieletowa</b> do kursu <i>Przetwarzanie obrazu</i></p>")); }
}
bool skeletonApp::saveFile(const QString& fileName)
bool skeletonApp::saveFile(const QString& fileName) {
{ QImageWriter writer(fileName);
QImageWriter writer(fileName);
if (!writer.write(image)) {
if (!writer.write(image)) { QMessageBox::information(this, QGuiApplication::applicationDisplayName(),
QMessageBox::information(this, QGuiApplication::applicationDisplayName(), tr("Cannot write %1: %2")
tr("Cannot write %1: %2") .arg(QDir::toNativeSeparators(fileName)), writer.errorString());
.arg(QDir::toNativeSeparators(fileName)), writer.errorString()); return false;
return false; }
} const QString message = tr("Wrote \"%1\"").arg(QDir::toNativeSeparators(fileName));
const QString message = tr("Wrote \"%1\"").arg(QDir::toNativeSeparators(fileName)); statusBar()->showMessage(message);
statusBar()->showMessage(message); return true;
return true; }
}
//! [1]
//! [1]
static void initializeImageFileDialog(QFileDialog& dialog, QFileDialog::AcceptMode acceptMode)
static void initializeImageFileDialog(QFileDialog& dialog, QFileDialog::AcceptMode acceptMode) {
{ static bool firstDialog = true;
static bool firstDialog = true;
if (firstDialog) {
if (firstDialog) { firstDialog = false;
firstDialog = false; const QStringList picturesLocations = QStandardPaths::standardLocations(QStandardPaths::PicturesLocation);
const QStringList picturesLocations = QStandardPaths::standardLocations(QStandardPaths::PicturesLocation); dialog.setDirectory(picturesLocations.isEmpty() ? QDir::currentPath() : picturesLocations.last());
dialog.setDirectory(picturesLocations.isEmpty() ? QDir::currentPath() : picturesLocations.last()); }
}
QStringList mimeTypeFilters;
QStringList mimeTypeFilters; const QByteArrayList supportedMimeTypes = acceptMode == QFileDialog::AcceptOpen
const QByteArrayList supportedMimeTypes = acceptMode == QFileDialog::AcceptOpen ? QImageReader::supportedMimeTypes() : QImageWriter::supportedMimeTypes();
? QImageReader::supportedMimeTypes() : QImageWriter::supportedMimeTypes(); for (const QByteArray& mimeTypeName : supportedMimeTypes)
for (const QByteArray& mimeTypeName : supportedMimeTypes) mimeTypeFilters.append(mimeTypeName);
mimeTypeFilters.append(mimeTypeName); mimeTypeFilters.sort();
mimeTypeFilters.sort();
dialog.setMimeTypeFilters(mimeTypeFilters);
dialog.setMimeTypeFilters(mimeTypeFilters); dialog.selectMimeTypeFilter("image/x-portable-pixmap");
dialog.selectMimeTypeFilter("image/x-portable-pixmap"); if (acceptMode == QFileDialog::AcceptSave)
if (acceptMode == QFileDialog::AcceptSave) dialog.setDefaultSuffix("ppm");
dialog.setDefaultSuffix("ppm"); }
}
void skeletonApp::open()
void skeletonApp::open() {
{ QFileDialog dialog(this, tr("Open File"));
QFileDialog dialog(this, tr("Open File")); initializeImageFileDialog(dialog, QFileDialog::AcceptOpen);
initializeImageFileDialog(dialog, QFileDialog::AcceptOpen);
while (dialog.exec() == QDialog::Accepted && !loadFile(dialog.selectedFiles().first())) {}
while (dialog.exec() == QDialog::Accepted && !loadFile(dialog.selectedFiles().first())) {} }
} //! [1]
//! [1]
void skeletonApp::saveAs()
void skeletonApp::saveAs() {
{ QFileDialog dialog(this, tr("Save File As"));
QFileDialog dialog(this, tr("Save File As")); initializeImageFileDialog(dialog, QFileDialog::AcceptSave);
initializeImageFileDialog(dialog, QFileDialog::AcceptSave);
while (dialog.exec() == QDialog::Accepted && !saveFile(dialog.selectedFiles().first())) {}
while (dialog.exec() == QDialog::Accepted && !saveFile(dialog.selectedFiles().first())) {} }
}
void skeletonApp::copy()
void skeletonApp::copy() {
{ #ifndef QT_NO_CLIPBOARD
#ifndef QT_NO_CLIPBOARD QGuiApplication::clipboard()->setImage(image);
QGuiApplication::clipboard()->setImage(image); #endif // !QT_NO_CLIPBOARD
#endif // !QT_NO_CLIPBOARD }
}
#ifndef QT_NO_CLIPBOARD
#ifndef QT_NO_CLIPBOARD static QImage clipboardImage()
static QImage clipboardImage() {
{ if (const QMimeData* mimeData = QGuiApplication::clipboard()->mimeData()) {
if (const QMimeData* mimeData = QGuiApplication::clipboard()->mimeData()) { if (mimeData->hasImage()) {
if (mimeData->hasImage()) { const QImage image = qvariant_cast<QImage>(mimeData->imageData());
const QImage image = qvariant_cast<QImage>(mimeData->imageData()); if (!image.isNull())
if (!image.isNull()) return image;
return image; }
} }
} return QImage();
return QImage(); }
} #endif // !QT_NO_CLIPBOARD
#endif // !QT_NO_CLIPBOARD
void skeletonApp::paste()
void skeletonApp::paste() {
{ #ifndef QT_NO_CLIPBOARD
#ifndef QT_NO_CLIPBOARD const QImage newImage = clipboardImage();
const QImage newImage = clipboardImage(); if (newImage.isNull()) {
if (newImage.isNull()) { statusBar()->showMessage(tr("No image in clipboard"));
statusBar()->showMessage(tr("No image in clipboard")); }
} else {
else { setImage(newImage);
setImage(newImage); setWindowFilePath(QString());
setWindowFilePath(QString()); const QString message = tr("Obtained image from clipboard, %1x%2, Depth: %3")
const QString message = tr("Obtained image from clipboard, %1x%2, Depth: %3") .arg(newImage.width()).arg(newImage.height()).arg(newImage.depth());
.arg(newImage.width()).arg(newImage.height()).arg(newImage.depth()); statusBar()->showMessage(message);
statusBar()->showMessage(message); }
} #endif // !QT_NO_CLIPBOARD
#endif // !QT_NO_CLIPBOARD }
}
void skeletonApp::zoomIn()
void skeletonApp::zoomIn() {
{ scaleImage(1.25);
scaleImage(1.25); }
}
void skeletonApp::zoomOut()
void skeletonApp::zoomOut() {
{ scaleImage(0.8);
scaleImage(0.8); }
}
void skeletonApp::normalSize()
void skeletonApp::normalSize() {
{ imageLabel->adjustSize();
imageLabel->adjustSize(); scaleFactor = 1.0;
scaleFactor = 1.0; }
}
void skeletonApp::fitToWindow()
void skeletonApp::fitToWindow() {
{ bool fitToWindow = fitToWindowAct->isChecked();
bool fitToWindow = fitToWindowAct->isChecked(); scrollArea->setWidgetResizable(fitToWindow);
scrollArea->setWidgetResizable(fitToWindow); if (!fitToWindow)
if (!fitToWindow) normalSize();
normalSize(); updateActions();
updateActions(); }
}
void skeletonApp::applyTestFilter()
void skeletonApp::applyTestFilter() {
{ dataResult.clear();
dataResult.clear();
for (int i = 0; i < height; i++)
for (int i = 0; i < height; i++) {
{ std::vector<std::vector<int>> row;
std::vector<std::vector<int>> row; for (int j = 0; j < width; j++)
for (int j = 0; j < width; j++) {
{ std::vector<int> pixel;
std::vector<int> pixel;
for (int k = 0; k < nbRealChannels; k++)
for (int k = 0; k < nbRealChannels; k++) {
{ pixel.push_back(255 - data[i][j][k]);
pixel.push_back(255 - data[i][j][k]); }//k
}//k
if (nbRealChannels < nbChannels)
if (nbRealChannels < nbChannels) pixel.push_back(255);
pixel.push_back(255);
row.push_back(pixel);
row.push_back(pixel); }//j
}//j dataResult.push_back(row);
dataResult.push_back(row); }//i
}//i
//uchar* img = new uchar[width * height * nbChannels];
//uchar* img = new uchar[width * height * nbChannels];
//std::vector<int> img;
//std::vector<int> img;
//for (int i = 0; i < height; i++)
//for (int i = 0; i < height; i++) //{
//{ // for (int j = 0; j < width; j++)
// for (int j = 0; j < width; j++) // {
// { // //std::vector<int> pixel1;
// //std::vector<int> pixel1;
// for (int k = 0; k < nbChannels; k++)
// for (int k = 0; k < nbChannels; k++) // {
// { // uchar t;
// uchar t; // t = (uchar)dataResult[i][j][k];
// t = (uchar)dataResult[i][j][k];
// //img[i * width * nbChannels + j * nbChannels + k] = (uchar)dataResult[i][j][k];
// //img[i * width * nbChannels + j * nbChannels + k] = (uchar)dataResult[i][j][k]; // img.push_back(dataResult[i][j][k]);
// img.push_back(dataResult[i][j][k]);
// }//k
// }//k // }//j
// }//j //}//i
//}//i
//std::ofstream file("test_zapisu_1.txt", std::ios::out);
//std::ofstream file("test_zapisu_1.txt", std::ios::out);
//if (file.good())
//if (file.good()) //{
//{
// for (int i = 0; i < image.height(); i++)//obraz jest w pliku zapisany
// for (int i = 0; i < image.height(); i++)//obraz jest w pliku zapisany // {
// {
// for (int j = 0; j < image.width(); j++)
// for (int j = 0; j < image.width(); j++) // {
// { // file << img[i * width + j];
// file << img[i * width + j]; // }
// } // file << "\n";
// file << "\n"; // }
// }
// file.close();
// file.close(); //}
//}
//const QByteArray dat = QByteArray::fromRawData(reinterpret_cast<const char*>(img.data()), img.size());
//const QByteArray dat = QByteArray::fromRawData(reinterpret_cast<const char*>(img.data()), img.size()); //QBuffer buffer(&dat);
//QBuffer buffer(&dat); // QImageReader reader(&buffer);
// QImageReader reader(&buffer); imageResult = QImage(width, height, image.format());
imageResult = QImage(width, height, image.format());
if (nbChannels > 1)
if (nbChannels > 1) for (int i = 0; i < image.height(); i++)//obraz jest w pliku zapisany
for (int i = 0; i < image.height(); i++)//obraz jest w pliku zapisany for (int j = 0; j < image.width(); j++)
for (int j = 0; j < image.width(); j++) imageResult.setPixel(j, i, qRgba(dataResult[i][j][0], dataResult[i][j][1], dataResult[i][j][2], dataResult[i][j][3]));
imageResult.setPixel(j, i, qRgba(dataResult[i][j][0], dataResult[i][j][1], dataResult[i][j][2], dataResult[i][j][3])); else
else if (image.bitPlaneCount() == 8)
if (image.bitPlaneCount() == 8) for (int i = 0; i < image.height(); i++)//obraz jest w pliku zapisany
for (int i = 0; i < image.height(); i++)//obraz jest w pliku zapisany for (int j = 0; j < image.width(); j++)
for (int j = 0; j < image.width(); j++) imageResult.setPixel(j, i, qRgba(dataResult[i][j][0], dataResult[i][j][0], dataResult[i][j][0],255));
imageResult.setPixel(j, i, qRgba(dataResult[i][j][0], dataResult[i][j][0], dataResult[i][j][0],255)); else
else {
{ imageResult.setColorCount(2);
imageResult.setColorCount(2); imageResult.setColor(0, qRgba(0, 0, 0, 255)); // Index #0 = Red
imageResult.setColor(0, qRgba(0, 0, 0, 255)); // Index #0 = Red imageResult.setColor(1, qRgba(255, 0, 0, 0));
imageResult.setColor(1, qRgba(255, 0, 0, 0));
for (int i = 0; i < image.height(); i++)//obraz jest w pliku zapisany
for (int i = 0; i < image.height(); i++)//obraz jest w pliku zapisany for (int j = 0; j < image.width(); j++)
for (int j = 0; j < image.width(); j++) {
{ if (dataResult[i][j][0] == 0)
if (dataResult[i][j][0] == 0) imageResult.setPixel(j, i, 0);
imageResult.setPixel(j, i, 0); else
else imageResult.setPixel(j, i, 1);
imageResult.setPixel(j, i, 1); }
}
}
} //imageResult = QImage(img,width,height,image.format());
//imageResult = QImage(img,width,height,image.format());
setImage(imageResult);
setImage(imageResult); }
}
void skeletonApp::updateActions()
void skeletonApp::updateActions() {
{ saveAsAct->setEnabled(!image.isNull());
saveAsAct->setEnabled(!image.isNull()); copyAct->setEnabled(!image.isNull());
copyAct->setEnabled(!image.isNull()); zoomInAct->setEnabled(!fitToWindowAct->isChecked());
zoomInAct->setEnabled(!fitToWindowAct->isChecked()); zoomOutAct->setEnabled(!fitToWindowAct->isChecked());
zoomOutAct->setEnabled(!fitToWindowAct->isChecked()); normalSizeAct->setEnabled(!fitToWindowAct->isChecked());
normalSizeAct->setEnabled(!fitToWindowAct->isChecked()); }
}
void skeletonApp::createActions()
void skeletonApp::createActions() {
{ QMenu* fileMenu = menuBar()->addMenu(tr("&File"));
QMenu* fileMenu = menuBar()->addMenu(tr("&File"));
QAction* openAct = fileMenu->addAction(tr("&Open..."), this, &skeletonApp::open);
QAction* openAct = fileMenu->addAction(tr("&Open..."), this, &skeletonApp::open); openAct->setShortcut(QKeySequence::Open);
openAct->setShortcut(QKeySequence::Open);
saveAsAct = fileMenu->addAction(tr("&Save As..."), this, &skeletonApp::saveAs);
saveAsAct = fileMenu->addAction(tr("&Save As..."), this, &skeletonApp::saveAs); saveAsAct->setEnabled(false);
saveAsAct->setEnabled(false);
fileMenu->addSeparator();
fileMenu->addSeparator();
QAction* exitAct = fileMenu->addAction(tr("E&xit"), this, &QWidget::close);
QAction* exitAct = fileMenu->addAction(tr("E&xit"), this, &QWidget::close); exitAct->setShortcut(tr("Ctrl+Q"));
exitAct->setShortcut(tr("Ctrl+Q"));
QMenu* editMenu = menuBar()->addMenu(tr("&Edit"));
QMenu* editMenu = menuBar()->addMenu(tr("&Edit"));
copyAct = editMenu->addAction(tr("&Copy"), this, &skeletonApp::copy);
copyAct = editMenu->addAction(tr("&Copy"), this, &skeletonApp::copy); copyAct->setShortcut(QKeySequence::Copy);
copyAct->setShortcut(QKeySequence::Copy); copyAct->setEnabled(false);
copyAct->setEnabled(false);
QAction* pasteAct = editMenu->addAction(tr("&Paste"), this, &skeletonApp::paste);
QAction* pasteAct = editMenu->addAction(tr("&Paste"), this, &skeletonApp::paste); pasteAct->setShortcut(QKeySequence::Paste);
pasteAct->setShortcut(QKeySequence::Paste);
QMenu* viewMenu = menuBar()->addMenu(tr("&View"));
QMenu* viewMenu = menuBar()->addMenu(tr("&View"));
zoomInAct = viewMenu->addAction(tr("Zoom &In (25%)"), this, &skeletonApp::zoomIn);
zoomInAct = viewMenu->addAction(tr("Zoom &In (25%)"), this, &skeletonApp::zoomIn); zoomInAct->setShortcut(QKeySequence::ZoomIn);
zoomInAct->setShortcut(QKeySequence::ZoomIn); zoomInAct->setEnabled(false);
zoomInAct->setEnabled(false);
zoomOutAct = viewMenu->addAction(tr("Zoom &Out (25%)"), this, &skeletonApp::zoomOut);
zoomOutAct = viewMenu->addAction(tr("Zoom &Out (25%)"), this, &skeletonApp::zoomOut); zoomOutAct->setShortcut(QKeySequence::ZoomOut);
zoomOutAct->setShortcut(QKeySequence::ZoomOut); zoomOutAct->setEnabled(false);
zoomOutAct->setEnabled(false);
normalSizeAct = viewMenu->addAction(tr("&Normal Size"), this, &skeletonApp::normalSize);
normalSizeAct = viewMenu->addAction(tr("&Normal Size"), this, &skeletonApp::normalSize); normalSizeAct->setShortcut(tr("Ctrl+S"));
normalSizeAct->setShortcut(tr("Ctrl+S")); normalSizeAct->setEnabled(false);
normalSizeAct->setEnabled(false);
viewMenu->addSeparator();
viewMenu->addSeparator();
fitToWindowAct = viewMenu->addAction(tr("&Fit to Window"), this, &skeletonApp::fitToWindow);
fitToWindowAct = viewMenu->addAction(tr("&Fit to Window"), this, &skeletonApp::fitToWindow); fitToWindowAct->setEnabled(false);
fitToWindowAct->setEnabled(false); fitToWindowAct->setCheckable(true);
fitToWindowAct->setCheckable(true); fitToWindowAct->setShortcut(tr("Ctrl+F"));
fitToWindowAct->setShortcut(tr("Ctrl+F"));
filtersMenu = menuBar()->addMenu(tr("&Filters"));
filtersMenu = menuBar()->addMenu(tr("&Filters")); filtersMenu->setDisabled(true);
filtersMenu->setDisabled(true);
testFilter = filtersMenu->addAction(tr("&TestFilter"), this, &skeletonApp::applyTestFilter);
testFilter = filtersMenu->addAction(tr("&TestFilter"), this, &skeletonApp::applyTestFilter); //testFilter->setDisabled(true);
//testFilter->setDisabled(true);
QMenu* helpMenu = menuBar()->addMenu(tr("&Help"));
QMenu* helpMenu = menuBar()->addMenu(tr("&Help"));
helpMenu->addAction(tr("&About"), this, &skeletonApp::about);
helpMenu->addAction(tr("&About"), this, &skeletonApp::about);
}
}

View File

@ -0,0 +1,27 @@
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++20
# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
main.cpp \
skeletonApp.cpp
HEADERS += \
skeletonApp.h
FORMS += \
skeletonApp.ui
TRANSLATIONS += \
SkeletonApp_en_150.ts
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

View File

@ -1,2 +1,2 @@
Jarosław Wieczorek Jarosław Wieczorek
Mateusz Winnicki Jagoda Jarowicz

View File

@ -1,15 +0,0 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
pyqt6 = "*"
pip = "*"
pyqt6-sip = "*"
pyqt5 = "*"
[dev-packages]
[requires]
python_version = "3.9"

2
python/__init__.py Normal file
View File

@ -0,0 +1,2 @@
"""Import classes"""
from skeletonApp import SkeletonApp

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 429 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 501 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 505 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 601 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 642 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 464 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 820 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 968 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 669 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 619 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 392 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 683 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 780 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 442 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 920 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 960 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 514 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 704 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 985 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 604 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1022 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 722 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 735 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 614 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 905 B

Some files were not shown because too many files have changed in this diff Show More