Giter VIP home page Giter VIP logo

stereograma's Introduction

Stereograma

This is a FREE open source cross-platform [stereogram maker/stereogram creator/stereogram generator/stereogram renderer] written in C++ using Qt. It aims to be fast, accurate, easy to use and multifunctional piece of software, as it uses the best algorithm (by W.A. Steer PhD) for generating auto-stereograms (see algorithm.pdf). It can even load 3D models in the .obj and .ply file formats. It also comes with some depth maps and textures so you can start to play from the first moment. One cool feature which is very unique is that it includes an interactive diagram that shows the depths of the resulted image, according to the rendering parameters.

There is also an interface for combining two pictures taken from different angles into anaglyph.

Where to download?

visit that link: https://kapandaria.wordpress.com/stereograma/

How to build:

Since it was developed with QtCreator, you can generate a makefile from the .pro file with qmake, or just compile it from within the IDE.

Support me!

I make many open source projects, and also contribute to the open source community. This project is a great example for that. If you liked this piece of software, and you want to give back, you don't have to open your wallet, just give a try to my mobile puzzle games:

https://play.google.com/store/apps/details?id=com.github.gnudles.rollingmarbles

stereograma's People

Contributors

gnudles avatar moreaki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

stereograma's Issues

Needs build instructions

I don't see anything that looks like build-system files, and there's no obvious documentation of the build order.

Figuring it out by guess and check is a serious hassle. Can we at least get a list of what order to build the pieces in? Or preferably a makefile or something that will just handle it?

Support macOS and upgrade to the newest QT 6.x library

I wanted to test your software on a macOS computer, but it didn't compile. So I did a quick-and-dirty 'eliminate all errors' until the source code compiled. Here is the resulting diff:

diff --git a/glmodelview.cpp b/glmodelview.cpp
index 74bcb5c..3f0d506 100644
--- a/glmodelview.cpp
+++ b/glmodelview.cpp
@@ -1,11 +1,17 @@
 #include "glmodelview.h"
 #include "stereomaker.h"
-#include "imageviewer.h"
+#if defined(__APPLE__)
+#define GL_SILENCE_DEPRECATION
+#include <OpenGL/gl.h>
+#include <OpenGL/glu.h>
+#else
+#include <GL/gl.h>
 #include <GL/glu.h>
+#endif
 #include <math.h>
 #include <stdio.h>
-#include <QGLShader>
-#include <QGLShaderProgram>
+#include <QOpenGLShader>>
+#include <QOpenGLShaderProgram>>
 #include <QMessageBox>
 #include <QProcess>
 #include <QCoreApplication>
@@ -13,7 +19,7 @@
 #include "trirender.h"
 
 GlModelView::GlModelView(QWidget *parent) :
-    QGLWidget(parent),m_zoom(500),m_contrast(100)
+    QOpenGLWidget(parent),m_zoom(500),m_contrast(100)
 {
     m_antialias=true;
     m_noShaders=false;
@@ -24,20 +30,20 @@ GlModelView::GlModelView(QWidget *parent) :
 
 void GlModelView::initializeGL()
 {
+    /* TODO
     if (!context()->isValid())
     {
         QMessageBox::warning(this,"No OpenGL Driver","Depth Map generation is still available");
-    }
-
+    }*/
 
-    if (QGLShader::hasOpenGLShaders(QGLShader::Vertex,context()) )
+    if (QOpenGLShader::hasOpenGLShaders(QOpenGLShader::Vertex,context()) )
     {
         QString declarations= "//uniform mat4 gl_ModelViewMatrix;  uniform mat4 gl_ProjectionMatrix; attribute vec4 gl_Vertex;\n";
         QString codev=       "void main()  {gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;"\
                 "float zmax=-1.0;"\
                 "float zmin=1.0;"\
                 "float scale=(zmax-zmin);float offs=-zmin;float z=(gl_Position.z/gl_Position.w); gl_FrontColor = vec4((z+offs)/scale,(z+offs)/scale,(z+offs)/scale,1.0); } ";
-        QGLShader shaderv(QGLShader::Vertex);
+        QOpenGLShader shaderv(QOpenGLShader::Vertex);
         bool compile_success=shaderv.compileSourceCode(declarations+codev);
         if (!compile_success)
         {
@@ -45,10 +51,11 @@ void GlModelView::initializeGL()
         }
         if (compile_success)
         {
-            QGLShaderProgram program(context());
-            program.addShader(&shaderv);
-            program.link();
-            program.bind();
+            QOpenGLShaderProgram *program;
+            program = new QOpenGLShaderProgram(this);
+            program->addShader(&shaderv);
+            program->link();
+            program->bind();
         }
         else
             m_noShaders=true;
diff --git a/glmodelview.h b/glmodelview.h
index 52c8e75..a3e08e5 100644
--- a/glmodelview.h
+++ b/glmodelview.h
@@ -1,12 +1,12 @@
 #ifndef GLMODELVIEW_H
 #define GLMODELVIEW_H
 
-#include <QGLWidget>
+#include <QOpenGLWidget>
 #include <QImage>
 #include <model3d.h>
 #include "basicimagewidget.h"
 
-class GlModelView : public QGLWidget,public BasicImageWidget
+class GlModelView : public QOpenGLWidget,public BasicImageWidget
 {
     Q_OBJECT
 public:
diff --git a/main.cpp b/main.cpp
index 0b8d633..d97f398 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1,15 +1,15 @@
 #include <QApplication>
 #include "mainwindow.h"
-#include <QGLFormat>
+#include <QSurfaceFormat>
 
 #include "parse.h"
 int main(int argc, char *argv[])
 {
     QApplication a(argc, argv);
-    QGLFormat glf = QGLFormat::defaultFormat();
-    glf.setSampleBuffers(true);
+    QSurfaceFormat glf = QSurfaceFormat::defaultFormat();
+    //TODO: glf.setSampleBuffers(true);
     glf.setSamples(4);
-    QGLFormat::setDefaultFormat(glf);
+    QSurfaceFormat::setDefaultFormat(glf);
     a.setWindowIcon(QIcon(":/images/stereograma.svg"));
     QCoreApplication::setOrganizationName("Kapandaria");
     QCoreApplication::setApplicationName("Stereograma");
diff --git a/model3d.cpp b/model3d.cpp
index 84b1796..be7b16f 100644
--- a/model3d.cpp
+++ b/model3d.cpp
@@ -1,5 +1,11 @@
 #include "model3d.h"
+#if defined(__APPLE__)
+#define GL_SILENCE_DEPRECATION
+#include <OpenGL/gl.h>
+#include <qopenglext.h>
+#else
 #include "qgl.h"
+#endif
 #include <stdio.h>
 #include <math.h>
 #include <limits.h>
diff --git a/stereograma.pro b/stereograma.pro
index d7448c6..d3c3d3b 100644
--- a/stereograma.pro
+++ b/stereograma.pro
@@ -4,8 +4,7 @@
 #
 #-------------------------------------------------
 
-QT       += core gui network opengl \
-    widgets
+QT       += core gui network openglwidgets widgets
 
 TARGET = stereograma
 TEMPLATE = app
diff --git a/stereomaker.cpp b/stereomaker.cpp
index 5581997..9fa1322 100644
--- a/stereomaker.cpp
+++ b/stereomaker.cpp
@@ -1,7 +1,7 @@
 //algorithm was taken from http://www.techmind.org/stereo/stech.html
 #include "stereomaker.h"
 #include <QPainter>
-#include <QTime>
+#include <QElapsedTimer>
 
 
 QVector<QRgb> StereoMaker::grayscale;
@@ -149,7 +149,7 @@ QImage StereoMaker::render(const QImage & map, const QImage & ptrn, Preset *pset
     int progbarval=0;
     int maxheight=dpi*(psettings->getMaximumDepth()-psettings->getMinimumDepth());
     //benchmark
-    QTime t_time;
+    QElapsedTimer t_time;
     t_time.start();
     unsigned int **patternptr=(unsigned int **)malloc(pattern_height*sizeof(void*));
     for (int i=pattern_height-1;i>=0;i--)
@@ -263,7 +263,7 @@ QImage StereoMaker::render(const QImage & map, const QImage & ptrn, Preset *pset
             qpbar->setValue(progbarval);
         }
     }
-    qDebug("Time elapsed: %d ms", t_time.elapsed());
+    qDebug("Time elapsed: %lld ms", t_time.elapsed());
     free(lookL);
     free(lookR);
     free(mapptr);

If you feel like this is something you'd like to add, let me know and I open a proper MR. The application starts up, and I can load some stuff (albeit, I have no idea what I need to do):

image

Command line mode?

Is it possible to run the application from command line?
I would like to batch process on an image sequence to see if it produces anything usable for video.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.