def resize_width(self, pixels, energy_calculator): (w, h) = self._original.size image = self._original.copy() for i in range(0, pixels): print "Removing seam #%d" % i energy = energy_calculator(image) self._energy = energy energy.calculate() costs = CostMatrix(energy.get_energy_matrix_shape()) costs.calculate(energy.get_energy_matrix()) self._costs = costs path = costs.find_shortest_path() image = self._carve_vertical(image, path) return image
def resize_width(self, pixels, energy_calculator): (w, h) = self._original.size image = self._original.copy() for i in range(0, pixels): print "Removing seam #%d" % i energy = energy_calculator(image) self._energy = energy energy.calculate() costs = CostMatrix(energy.get_energy_matrix_shape()) costs.calculate(energy.get_energy_matrix()) self._costs = costs path = costs.find_shortest_path() image = self._carve_vertical(image, path) # debug zeige das neue bildchen #image.show(); tmpname="seam_%0*d.jpg" % (3,i) image.save(tmpname) return image
def resize_width(self, pixels, energy_calculator): (w, h) = self._original.size image = self._original.copy() for i in range(0, pixels): print "Removing seam #%d" % i energy = energy_calculator(image) self._energy = energy energy.calculate() costs = CostMatrix(energy.get_energy_matrix_shape()) costs.calculate(energy.get_energy_matrix()) self._costs = costs path = costs.find_shortest_path() image = self._carve_vertical(image, path) # debug zeige das neue bildchen #image.show(); tmpname = "seam_%0*d.jpg" % (3, i) image.save(tmpname) return image