Skip to content
  • 0 Votes
    2 Posts
    2k Views
    R

    Alright after developing spine problems from leaning into my screen for a week and losing more hair than my GPU has cores, I sort of fixed the issue.

    So for some reason when I was reading data into my textures without setting the active texture back to the GL_TEXTURE0 default, things were going sideways.

    So basically I had something like:

    glActiveTexture(GL_TEXTURE0 + inputTextureUnit[vid]); glBindTexture(GL_TEXTURE_2D, inputTextureID[vid]); glTexImage2D(GL_TEXTURE_2D, 0, GL_internalFormat[vid], videoSpecs[vid].videoWidth, videoSpecs[vid].videoHeight, 0, GL_format[vid], GL_UNSIGNED_BYTE, (const void*)(frame));

    But this was missing at the end:

    glBindTexture(GL_TEXTURE_2D, 0); glActiveTexture(GL_TEXTURE0);

    But I'm not 100% convinced that this is the cause because if I read still images, there is no issue. Its only when I read videos that I see the flickering and black texture issue. It seems like when other widgets start rendering and there is a texture active, they somehow corrupt it but I would certainly appreciate it if anyone has input on what actually might be happening.

  • 0 Votes
    17 Posts
    6k Views
    L

    @jgmills Your problem is that you are importing some Pylon headers in the wrong order/missing some include.
    Basler suggest importing first the #include <pylon/PylonIncludes.h> and after all the others needed in your headers file.
    Checking the latter include you can find a comment:

    // PylonPlatform.h must be included before including any GenICam/GenApi header files, // to ensure that the GENICAM_COMPILER_STR macro used by GenICam/GenApi is set properly #include <pylon/Platform.h> #include <pylon/PylonLinkage.h>

    That macro next enables the definition of GENICAM_USER_ALWAYS_LINK_RELEASE. This definition tells the compiler to link the library with the MD specification also in debug mode.
    Concluding, to be able to work in debug mode you can choose between:

    In your headers that need some pylon include, add as first the #include <pylon/PylonIncludes.h> If you want to avoid all the inclusion made by the latter, in your headers that need some pylon include, add as first the #include <pylon/Platform.h> and the #include <pylon/PylonLinkage.h>
  • 0 Votes
    6 Posts
    2k Views
    raven-worxR

    @sush
    this is actually outside of the scope of Qt.
    You should use a graphics processing library (like OpenCV - i don't know if it offers such functionality) to do such stuff. Or you need to implement an appropriate algorithmn yourself which uses the Qt API to access the pixel data.

    This is by far a complicated topic.

    You may want to read the following links:
    Overview
    Perceptual Image Diff lib
    QGoImageComapre

  • 0 Votes
    2 Posts
    1k Views
    A

    Hi,
    QPainter can draw a QImage. So you can for example create a new Widget, subclass for QLabel for example if you want and reimplement paintEvent. Like this you work all the time with your QImage without creating another one.
    And better you can only update the region that changed, no need to refresh everything. I did not try it but it should work.
    Sincerely

  • 0 Votes
    5 Posts
    4k Views
    bahman309B

    @Joel-Bodenmann
    Thank you so much

  • 0 Votes
    4 Posts
    3k Views
    sankarapandiyanS

    you have to download dicom folders with images
    and then copy this code there ,

    #include <vtkSmartPointer.h>
    #include <vtkImageViewer2.h>
    #include <vtkDICOMImageReader.h>
    #include <vtkRenderWindow.h>
    #include <vtkRenderWindowInteractor.h>
    #include <vtkRenderer.h>

    int main(int argc, char* argv[])
    {
    std::string inputFilename ="path of dicomm images/xr_hands.dcm";

    // Read all the DICOM files in the specified directory.
    vtkSmartPointer<vtkDICOMImageReader> reader =
    vtkSmartPointer<vtkDICOMImageReader>::New();
    reader->SetFileName(inputFilename.c_str());
    reader->Update();

    // Visualize
    vtkSmartPointer<vtkImageViewer2> imageViewer =
    vtkSmartPointer<vtkImageViewer2>::New();
    imageViewer->SetInputConnection(reader->GetOutputPort());
    vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
    vtkSmartPointer<vtkRenderWindowInteractor>::New();
    imageViewer->SetupInteractor(renderWindowInteractor);
    imageViewer->Render();
    imageViewer->GetRenderer()->ResetCamera();
    imageViewer->Render();

    renderWindowInteractor->Start();

    return EXIT_SUCCESS;
    }

    it will definetly runs without error .. you must gave a riht path of dicom images

  • 0 Votes
    4 Posts
    2k Views
    ?

    I'm not completely sure what you mean. If you want to get the current position of the mouse cursor in coordinates relative the widget that displays your image then you can do this:

    QPoint currentPosition = widget->mapFromGlobal( QCursor::pos() );
  • 0 Votes
    2 Posts
    1k Views
    A

    Thanks @tekojo and of course Qt.
    Image Transformer is now being displayed in Qt Showroom:
    https://showroom.qt.io/image-transformer/