Beispiel #1
0
    def _runLayer(self, layer_file):
        if layer_file is None:
            return
        C0_8U = loadRGBA(layer_file)

        if C0_8U is None:
            C0_8U = loadRGB(layer_file)

        if C0_8U is None:
            return

        h, w = C0_8U.shape[:2]
        w_low = 1024
        h_low = w_low * h / w

        #  C0_8U = cv2.resize(C0_8U, (w_low, h_low))

        A_8U = alpha(C0_8U)
        self._A_8U = A_8U

        C0_32F = to32F(rgb(C0_8U))

        if A_8U is not None:
            C0_32F[A_8U < 0.9 * np.max(A_8U), :] = np.array([0, 0, 0])

        self._C0_32F = C0_32F

        self._loadImage()
        self._computeBaseDetalSeparation()
        self._computeInitialDetailNormal()
        self.computeDetailNormal()
        self._computeLumoNormal()
        self.computeInitialNormal()

        # plt.savefig(self.characterResultFile("BumpNormal.png"))

        if self._N_b_smooth is not None:
            self.cleanCharacterResultDir()
            saveNormal(self.characterResultFile("N_b.png"), self._N_b, A_8U)
            saveNormal(self.characterResultFile("N_b_smooth.png"),
                       self._N_b_smooth, A_8U)
            saveNormal(self.characterResultFile("N_d.png"), self._N_d, A_8U)
            saveNormal(self.characterResultFile("N_d_smooth.png"),
                       self._N_d_smooth, A_8U)
            saveNormal(self.characterResultFile("N_lumo.png"), self._N_lumo,
                       A_8U)
            saveNormal(self.characterResultFile("N0_b.png"), self._N0_b_32F,
                       A_8U)
            saveNormal(self.characterResultFile("N0_d.png"), self._N0_d_32F,
                       A_8U)
    def _runLayer(self, layer_file):
        if layer_file is None:
            return
        C0_8U = loadRGBA(layer_file)

        if C0_8U is None:
            C0_8U = loadRGB(layer_file)

        if C0_8U is None:
            return

        h, w = C0_8U.shape[:2]
        w_low = 1024
        h_low = w_low * h / w

        #  C0_8U = cv2.resize(C0_8U, (w_low, h_low))

        A_8U = alpha(C0_8U)
        self._A_8U = A_8U

        C0_32F = to32F(rgb(C0_8U))

        if A_8U is not None:
            C0_32F[A_8U < 0.9 * np.max(A_8U), :] = np.array([0, 0, 0])

        self._C0_32F = C0_32F

        self._loadImage()
        self._computeBaseDetalSeparation()
        self._computeInitialDetailNormal()
        self.computeDetailNormal()
        self._computeLumoNormal()
        self.computeInitialNormal()

        # plt.savefig(self.characterResultFile("BumpNormal.png"))

        if self._N_b_smooth is not None:
            self.cleanCharacterResultDir()
            saveNormal(self.characterResultFile("N_b.png"), self._N_b, A_8U)
            saveNormal(self.characterResultFile("N_b_smooth.png"), self._N_b_smooth, A_8U)
            saveNormal(self.characterResultFile("N_d.png"), self._N_d, A_8U)
            saveNormal(self.characterResultFile("N_d_smooth.png"), self._N_d_smooth, A_8U)
            saveNormal(self.characterResultFile("N_lumo.png"), self._N_lumo, A_8U)
            saveNormal(self.characterResultFile("N0_b.png"), self._N0_b_32F, A_8U)
            saveNormal(self.characterResultFile("N0_d.png"), self._N0_d_32F, A_8U)
def loadColorMap(file_path):
    M_32F = to32F(loadRGB(file_path))
    h, w = M_32F.shape[:2]
    #M_32F = cv2.resize(M_32F, (4 * w, h))
    #M_32F = cv2.bilateralFilter(M_32F, 0, 0.1, 3)
    return M_32F[0, :, :]
def loadColorMap(file_path):
    M_32F = to32F(loadRGB(file_path))
    h, w = M_32F.shape[:2]
    #M_32F = cv2.resize(M_32F, (4 * w, h))
    #M_32F = cv2.bilateralFilter(M_32F, 0, 0.1, 3)
    return M_32F[0, :, :]