There are two ways to collect seeds:
1. Wait for the seed pods or seedheads to dry out completely on the plant. Think: peas, beans, radishes, spinach, and parsley.
2. Wait for the vegetable to over-ripen a bit on the plant to ensure the seeds are mature. Think: tomatoes, cucumbers, eggplants, peppers, and squash.
With the first method, you want to gather the seeds when they have hardened and dried out, but before the seeds drop from the plant (as with flowering seedheads) or before the pods and capsules split open (as with legumes).
Collecting seeds from ornamental flowers is most efficient when you’re deadheading spent blooms, as they’re easy to miss if you wait too long before they fall.