def without_staves(self): """ Return the image without staves """ if self._ms is None: self._ms = remstaves(self._image) return self._ms.image
# This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. from remove import remstaves if __name__ == '__main__': from gamera.core import * import sys init_gamera() for i,imgname in enumerate(sys.argv[1:]): image = load_image(imgname) image = image.to_onebit() try: ms = remstaves(image) except: ms = remstaves_skeleton(image) ccs = ms.image.cc_analysis() print "%s: %s"%(imgname,[(i,c.label) for i,c in enumerate(ccs) ]) sys.stdout.flush()
import sys import re import time init_gamera() progress = 0 amount = len(sys.argv[1:]) elapsed = 0 for i, imgname in enumerate(sys.argv[1:]): progress = ((i + 1) / float(amount)) * 100 m = re.match(r"^(.*)\.[^\.]+$", imgname) noend = m.group(1) image = load_image(imgname) rgbimg = image.to_rgb() image = image.to_onebit() ms = remstaves(image) ccs = ms.image.cc_analysis() cond = inout_staff_condition(ms.get_staffpos()) for c in ccs: if cond(c): # insid col = RGBPixel(255, 0, 0) else: col = RGBPixel(0, 255, 0) outline(rgbimg, c, 2.0, col) savename = "insideoutside_%s.png" % noend rgbimg.save_PNG(savename) print "Saved %s" % savename sys.stdout.flush()