# Path: reid/preproc/imageproc.py
# def imtranslate(image, translation):
# def imresize(image, shape, keep_ratio=False):
# def subtract_luminance(rgbimg, mean_luminance=None):
# def scale_per_channel(img, scale_range):
# def binarize(img, threshold):
# def images2mat(images):
# 
# Path: reid/utils/gui_utils.py
# def ndarray2qimage(array):
#     """Convert from numpy.ndarray to QImage
# 
#     Args:
#         array: An numpy.ndarray of size h*w*c. The number of channels could be
#                either one or three, one stands for grayscale image, three stands
#                for RGB image. The dtype must be numpy.uint32.
# 
#     Returns:
#         A QImage object constructed from given array.
#     """
# 
#     array = array.astype('uint32')
# 
#     if array.ndim == 2:
#         h, w = array.shape
#         data = (255 << 24 | array << 16 | array << 8 | array)
#     elif array.ndim == 3:
#         h, w, c = array.shape
#         if c == 1:
#             data = (255 << 24 | array[:,:,0] << 16 | array[:,:,0] << 8 | array[:,:,0])
#         elif c == 3:
#             data = (255 << 24 | array[:,:,0] << 16 | array[:,:,1] << 8 | array[:,:,2])
#         else:
#             raise ValueError("ndarray2qimage cannot recognize the image type")
#     else:
#         raise ValueError("ndarray2qimage cannot recognize the image type")
# 
#     data = data.ravel()
#     return QImage(data, w, h, QImage.Format_RGB32).copy()


import sys
import os
import shelve
import numpy
import attrconf
from scipy.io import loadmat, savemat
from PySide import QtGui, QtCore
from reid.preproc import imageproc
from reid.utils.gui_utils import ndarray2qimage
#!/usr/bin/python2
# -*- coding: utf-8 -*-



class LabellingWindow(QtGui.QMainWindow):
    def __init__(self, parent=None):
        super(LabellingWindow, self).__init__(parent)

        self.cpath = os.path.join(QtCore.QDir.homePath(), '.labelattr.db')
        self.fpath = None
        self.is_dirty = False

        self.set_codec('UTF-8')

        self._create_menus()
        self._create_panels()

        self.setWindowTitle(self.tr("Attribute Labelling"))
        self.showMaximized()

    @staticmethod
    def show_message(message):
        msgbox = QtGui.QMessageBox()
        msgbox.setText(message)

# Path: reid/preproc/imageproc.py
# def imtranslate(image, translation):
# def imresize(image, shape, keep_ratio=False):
# def subtract_luminance(rgbimg, mean_luminance=None):
# def scale_per_channel(img, scale_range):
# def binarize(img, threshold):
# def images2mat(images):
# 
# Path: reid/utils/gui_utils.py
# def ndarray2qimage(array):
#     """Convert from numpy.ndarray to QImage
# 
#     Args:
#         array: An numpy.ndarray of size h*w*c. The number of channels could be
#                either one or three, one stands for grayscale image, three stands
#                for RGB image. The dtype must be numpy.uint32.
# 
#     Returns:
#         A QImage object constructed from given array.
#     """
# 
#     array = array.astype('uint32')
# 
#     if array.ndim == 2:
#         h, w = array.shape
#         data = (255 << 24 | array << 16 | array << 8 | array)
#     elif array.ndim == 3:
#         h, w, c = array.shape
#         if c == 1:
#             data = (255 << 24 | array[:,:,0] << 16 | array[:,:,0] << 8 | array[:,:,0])
#         elif c == 3:
#             data = (255 << 24 | array[:,:,0] << 16 | array[:,:,1] << 8 | array[:,:,2])
#         else:
#             raise ValueError("ndarray2qimage cannot recognize the image type")
#     else:
#         raise ValueError("ndarray2qimage cannot recognize the image type")
# 
#     data = data.ravel()
#     return QImage(data, w, h, QImage.Format_RGB32).copy()


# Path: scripts/labelattr.py
import sys
import os
import shelve
import numpy
import attrconf
from scipy.io import loadmat, savemat
from PySide import QtGui, QtCore
from reid.preproc import imageproc
from reid.utils.gui_utils import ndarray2qimage

#!/usr/bin/python2
# -*- coding: utf-8 -*-



class LabellingWindow(QtGui.QMainWindow):
    def __init__(self, parent=None):
        super(LabellingWindow, self).__init__(parent)

        self.cpath = os.path.join(QtCore.QDir.homePath(), '.labelattr.db')
        self.fpath = None
        self.is_dirty = False

        self.set_codec('UTF-8')

        self._create_menus()
        self._create_panels()

        self.setWindowTitle(self.tr("Attribute Labelling"))
        self.showMaximized()

    @staticmethod
    def show_message(message):
        msgbox = QtGui.QMessageBox()
        msgbox.setText(message)

        msgbox.exec_()